我有這樣的代碼在這裏:的Javascript沒有運行
var Questions=[]
Questions[0]=["What is the answer?",["A","B","C","D"],3]
Questions[1]=["What is the answer?",["A","B","C","D"],3]
Questions[2]=["What is the answer?",["A","B","C","D"],3]
Questions[3]=["What is the answer?",["A","B","C","D"],3]
function createQuestions(id) {
var tReturn="<form>"
tReturn=tReturn+"<b>Questions "+id+":</b>"
tReturn=tReturn+"</form>"
return tReturn;
}
for (i=0;i<4;i++) {
var elem=document.getElementById('quiz_section')
var func=createQuestion(i)
elem.innerHTML=elem.innerHTML+func+"<br />"
}
我剛剛使用JavaScript開始。我知道在這裏肯定有語法錯誤,但我找不到它。實際上,在主文檔中有一個ID爲「quiz_selection」的DIV。
我無法訪問任何類型的調試器,因爲我在學校,幾乎所有的東西都被阻塞了。
如果可以的話,謝謝!
用分號';'結束行是一個好習慣,但這不是語法錯誤的情況。 – pimvdb 2011-04-11 18:03:46