开发者

Why does this code give an error?

$("#main").animate({ 
dis开发者_Python百科play: "block",
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em", 
borderWidth: "10px"
} 1500);

This is jQuery. I get a "missing ) after arguement list" message. What's wrong?


umm

} 1500);

missing comma before 1500

may i suggest using http://www.jslint.com/ for this in the future? if you paste in that code block in there you will get the following errors:

Error:
Problem at line 8 character 3: Expected ')' and instead saw '1500'.

} 1500);

Problem at line 8 character 7: Missing semicolon.

} 1500);

Problem at line 8 character 7: Expected an identifier and instead saw ')'.

} 1500);

Problem at line 8 character 7: Stopping, unable to continue. (100% scanned).

Implied global: $ 1

after that, it its pretty easy to see that your error must be on line 8..


You need a comma before the duration at the end (currently } 1500);), like this:

$("#main").animate({ 
display: "block",
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em", 
borderWidth: "10px"
}, 1500);


$("#main").animate({ 
display: "block",
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em", 
borderWidth: "10px"
}, 1500); // you have forgotten the comma here...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜