简体   繁体   English

为什么此代码给出错误?

[英]Why does this code give an error?

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

This is jQuery. 这是jQuery。 I get a "missing ) after arguement list" message. 我收到“缺少论据列表”消息。 What's wrong? 怎么了?

umm

} 1500);

missing comma before 1500 1500年之前缺少逗号

may i suggest using http://www.jslint.com/ for this in the future? 我将来可以建议使用http://www.jslint.com/吗? 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.. 之后,很容易看到您的错误必须在第8行。

You need a comma before the duration at the end (currently } 1500); 您需要在最后的持续时间(当前为} 1500);之前输入逗号} 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...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM