我在Dreamweaver中没有明显的原因给出语法错误

时间:2016-10-20 11:38:42

标签: javascript dreamweaver

<script>
function changeLight(){
    lightOne
    lightTwo
    lightThree
}
function lightOne(){

}
var list1=[
    "../../../Pictures/lights/red.png"
    "../../../Pictures/lights/red.png"
    "../../../Pictures/lights/red.png"
    "../../../Pictures/lights/red.png"
    "../../../Pictures/lights/lit red.png"
    ]
var list2=[
    "../../../Pictures/lights/orange.png"
    "../../../Pictures/lights/lit orange.png"
    "../../../Pictures/lights/orange.png"
    "../../../Pictures/lights/lit orange.png"
    "../../../Pictures/lights/lit orange.png"
]
var list3=[
    "../../../Pictures/lights/green.png"
    "../../../Pictures/lights/green.png"
    "../../../Pictures/lights/lit green.png"
    "../../../Pictures/lights/green.png"
    "../../../Pictures/lights/green.png"
]
</script>

这是Dreamweaver中错误消息和代码的屏幕截图

.

我没有看到任何理由在这一行上出现错误,因为它没有在上面的行上找到错误。

我是javascript的初学者,所以这段代码很乱。

1 个答案:

答案 0 :(得分:0)

这应该是:

<script>
function changeLight(){
    lightOne();
    // lightTwo();
    // lightThree();
}
function lightOne(){

}
var list1=[
    "../../../Pictures/lights/red.png",
    "../../../Pictures/lights/red.png",
    "../../../Pictures/lights/red.png",
    "../../../Pictures/lights/red.png",
    "../../../Pictures/lights/lit red.png"
    ];
var list2=[
    "../../../Pictures/lights/orange.png",
    "../../../Pictures/lights/lit orange.png",
    "../../../Pictures/lights/orange.png",
    "../../../Pictures/lights/lit orange.png",
    "../../../Pictures/lights/lit orange.png"
];
var list3=[
    "../../../Pictures/lights/green.png",
    "../../../Pictures/lights/green.png",
    "../../../Pictures/lights/lit green.png",
    "../../../Pictures/lights/green.png",
    "../../../Pictures/lights/green.png"
];
</script>