2010-06-01 226 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... 
相關問題