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

这是jQuery。我在争论清单“消息后得到”缺失)。怎么了?这段代码为什么会出错?

+0

以防万一你不知道的是,你错过了一个逗号(笑)..我只是不得不写后此评论阅读答案 – jAndy 2010-06-01 13:35:11

+0

@jAndy - 是的!你发现了它......我自己一直在想这么久以来发生了什么错误......谢谢! :) – Reigel 2010-06-01 13:46:47

+0

我害怕自己有多快,我明白了这一点! – jAndy 2010-06-01 13:53:57

回答

6

乌姆

} 1500); 

失踪1500

可我建议使用http://www.jslint.com/之前逗号此的未来?如果你在一个代码块粘贴在那里你会得到以下错误:

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 

,它它很容易看到你的错误必须在8号线..

3

你需要一个逗号在结束(目前} 1500);)的持续时间,这样才:

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