五道选择题,你选择提交后会出现成绩及各题说明,最后有评语 - 中国WEB开发者网络 (http://www.webasp.net) -- 网页特效 (http://www.webasp.net/javascript/) --- 五道选择题,你选择提交后会出现成绩及各题说明,最后有评语 (http://www.webasp.net/javascript/1/604.htm) |
| -- 发布日期: 2005-06-22 |
| <!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! --> <!-- 要实现此效果需要 1 个步骤: --> <!-- 第 1 步: --> <!-- 把下面的代码加到<BODY></BODY>区域中: --> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var ans = new Array; var done = new Array; var yourAns = new Array; var explainAnswer = new Array; var score = 0; ans[1] = "b"; ans[2] = "b"; ans[3] = "a"; ans[4] = "c"; ans[5] = "b"; explainAnswer[1]="你的回答是不正确,努力哟!"; explainAnswer[2]="你的回答是不正确,努力哟!"; explainAnswer[3]="你的回答是不正确,努力哟!"; explainAnswer[4]="你的回答是不正确,努力哟!"; explainAnswer[5]="你的回答是不正确,努力哟!"; function Engine(question, answer) { yourAns[question]=answer; } function Score(){ var answerText = "看看你的成绩如何?\n------------------------------------\n"; for(i=1;i<=5;i++){ answerText=answerText+"\n问题:"+i+"\n"; if(ans[i]!=yourAns[i]){ answerText=answerText+"\n正常的答案是: "+ans[i]+"\n"+explainAnswer[i]+"\n"; } else{ answerText=answerText+" \n对的 \n"; score++; } } answerText=answerText+"\n\n你的成绩是 : "+score+"\n"; //now score the user answerText=answerText+"\n结论 : "; if(score<=0){ answerText=answerText+"你应该好好多学点了!"; } if(score>=1 && score <=2){ answerText=answerText+"你还是有些知识欠缺的!"; } if(score>=3 && score <=3){ answerText=answerText+"做的还不错,但还需要努力!"; } if(score>4){ answerText=answerText+"哇,你可真是厉害,高手,高手!!"; } alert(answerText); } // End --> </script> <b>Test your knowledge of Java!</b> <hr> <FORM> <b>1. What is the name of the Java mascot?</b><br> <input type=radio name="q1" value="a" onClick="Engine(1, this.value)">a) Luke<br> <input type=radio name="q1" value="b" onClick="Engine(1, this.value)">b) Duke<br> <input type=radio name="q1" value="c" onClick="Engine(1, this.value)">c) Nuke<br> <input type=radio name="q1" value="d" onClick="Engine(1, this.value)">d) Sunny<p> <b>2. Where is the best place to get Java software?</b><br> <input type=radio name="q2" value="a" onClick="Engine(2, this.value)">a) From a can<br> <input type=radio name="q2" value="b" onClick="Engine(2, this.value)">b) From java.sun.com<br> <input type=radio name="q2" value="c" onClick="Engine(2, this.value)">c) You have to buy it from Microsoft<br> <input type=radio name="q2" value="d" onClick="Engine(2, this.value)">d) From your local Star Bucks<p> <b>3. A 'for' loop in Java looks like this....</b><br> <input type=radio name="q3" value="a" onClick="Engine(3, this.value)">a) for(int i=0;i<5;i++){}<br> <input type=radio name="q3" value="b" onClick="Engine(3, this.value)">b) for i=1 to 5 do<br> <input type=radio name="q3" value="c" onClick="Engine(3, this.value)">c) repeat...until(i=5)<br> <input type=radio name="q3" value="d" onClick="Engine(3, this.value)">d) FOR I:=5 DOWNTO 1 DO <p> <b>4. Which platform can not run Java.</b><br> <input type=radio name="q4" value="a" onClick="Engine(4, this.value)">Linux<br> <input type=radio name="q4" value="b" onClick="Engine(4, this.value)">Windows NT<br> <input type=radio name="q4" value="c" onClick="Engine(4, this.value)">Commodore 64<br> <input type=radio name="q4" value="d" onClick="Engine(4, this.value)">Apple Mac<p> <b>5. 'JMF' stands for: </b><br> <input type=radio name="q5" value="a" onClick="Engine(5, this.value)">A pop group of the 90's who had the hit "Unbelievable"<br> <input type=radio name="q5" value="b" onClick="Engine(5, this.value)">Java Media Framework<br> <input type=radio name="q5" value="c" onClick="Engine(5, this.value)">Java Messaging Framework<br> <input type=radio name="q5" value="d" onClick="Engine(5, this.value)">Java Meditation Forum<p> <CENTER> <input type=button onClick="Score()" value="看看我的成绩?"> </CENTER> </FORM> |
| webasp.net |