[問題] 看不到數字

看板Ajax作者 (Dr.Lee)時間17年前 (2007/06/26 22:46), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
下面的程式可以執行 不過一開卻看不到數字 可以幫看一下哪裡有錯嗎 因為應該是一開始就有數字了 不過卻看不到 謝謝 <html> <head> <meta http-equiv="Content-Language" content="zh-tw"> <meta http-equiv="Content-Type" content="text/html; charset=big5"> <title>動動腦時間</title> </head> <script language="javascript"> <!-- var x=0; var y=0; var z=0; var w=0; var count=0; var correct=0; function generQQ(){ //隨機產生整數 x=parseInt(Math.random()*19)+1; y=parseInt(Math.random()*9)+1; z=parseInt(Math.random()*9)+1; w=parseInt(Math.random()*19)+1; //將產生的值指定給T1和T2和T3和T4 document.myform.T1.value=x; document.myform.T2.value=y; document.myform.T3.value=z; document.myform.T4.value=w; //T5一開始設定為空白,並取得焦點 document.myform.T5.value=""; document.myform.T5.focus(); //將ans1, ans2都設為隱藏 document.all.A1.style.visibility="hidden"; document.all.A2.style.visibility="hidden"; count +=1; } function checkAns(){ var ans= document.myform.T5.value; //是否按下Enter鍵 if(event.keyCode==13) { //答案是否正確 if(x+y*z-w == ans){ correct += 1; A1.style.visibility="visible"; alert("目前答對比例:" + correct + "/" + count); }else{ A2.style.visibility="visible"; } } } //--> </script> <body> <form name="myform" action="--WEBBOT-SELF--" method="POST"> <!--webbot bot="SaveResults" U-File="C:\Documents and Settings\Administrator\桌面\_private\form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --> <p>動動腦時間 : <input type="button" value="下一題" name="B1" onclick="generQQ()"></p> <p> <input type="text" name="T1" size="10">+ <input type="text" name="T2" size="10">* <input type="text" name="T3" size="10">- <input type="text" name="T4" size="10">= <input type="text" name="T5" size="20" onkeydown="checkAns();"></p> </form> <div id="A1" style="position:absolute; top:110px; left:146px; width:75px; height:20px; color:blue; visibility:hidden" > 答對了! </div> <div id="A2" style="position:absolute; top:110px; left:146px; width:75px; height:20px; color:red; visibility:hidden " > 答錯了! </div> </body> </html> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.127.186.4 ※ 編輯: m81632 來自: 140.127.186.4 (06/26 22:53)
文章代碼(AID): #16WIRZXV (Ajax)