哪里出现错误了,怎么找也找不出来?<html>
<head> </head> <body onload = "chooseQ()"> <div id = "question1">
</div> <div id = "question2">
</div> <script type="text/javascript">
<!-- var count = ["1","2"]
var controlNum; function chooseQ(){
var arr = new Array();
var num;
for(var i = 0, j; i < 2; i++){
num = Math.floor(1 + Math.random() * 3);
for(j = 0; j < arr.length; j++){
if(arr[j] == num)
break;
}
if(j == arr.length){
arr[j] = num;
printQ(num);
controlNum = i;
}
else{
i--;
}
}
} function printQ(n){
switch (n){ case 1:
document.getElementById("question" + count[controlNum]).innerHTML
= "<form id = 'Q1' action = ''>"
+ "<p>"
+ "The ___ is just around the corner and you won’t miss it."
+ "<br /><label><input type = 'radio' name = 'radiobutton' value = 'A'>"
+ "A.bicycle's shop"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'B'>"
+ "B.bicycle shop"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'C'>"
+ "C.bicycles shop"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'D'>"
+ "D.bicycles' shop"
+ "</label><br /></p></form>";
break; case 2:
document.getElementById("question" + count[controlNum]).innerHTML
= "<form id = 'Q2' action = ''>"
+ "<p>"
+ "His daughter is always shy in ___ and she never dares to make a speech to ___."
+ "<br /><label><input type = 'radio' name = 'radiobutton' value = 'A'>"
+ "A.the public…the public"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'B'>"
+ "B.public…the public"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'C'>"
+ "C.the public…public"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'D'>"
+ "D.public…public"
+ "</label><br /></p></form>";
break; case 3:
document.getElementById("question" + count[controlNum]).innerHTML
= "<form id = 'Q3' action = ''>"
+ "<p>"
+ "Rose was wild with joy ___ the result of the examination."
+ "<br /><label><input type = 'radio' name = 'radiobutton' value = 'A'>"
+ "A.to"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'B'>"
+ "B.at"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'C'>"
+ "C.by"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'D'>"
+ "D.as"
+ "</label><br /></p></form>";
break;
}
}
//-->
</script>
</body>
</html>
<head> </head> <body onload = "chooseQ()"> <div id = "question1">
</div> <div id = "question2">
</div> <script type="text/javascript">
<!-- var count = ["1","2"]
var controlNum; function chooseQ(){
var arr = new Array();
var num;
for(var i = 0, j; i < 2; i++){
num = Math.floor(1 + Math.random() * 3);
for(j = 0; j < arr.length; j++){
if(arr[j] == num)
break;
}
if(j == arr.length){
arr[j] = num;
printQ(num);
controlNum = i;
}
else{
i--;
}
}
} function printQ(n){
switch (n){ case 1:
document.getElementById("question" + count[controlNum]).innerHTML
= "<form id = 'Q1' action = ''>"
+ "<p>"
+ "The ___ is just around the corner and you won’t miss it."
+ "<br /><label><input type = 'radio' name = 'radiobutton' value = 'A'>"
+ "A.bicycle's shop"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'B'>"
+ "B.bicycle shop"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'C'>"
+ "C.bicycles shop"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'D'>"
+ "D.bicycles' shop"
+ "</label><br /></p></form>";
break; case 2:
document.getElementById("question" + count[controlNum]).innerHTML
= "<form id = 'Q2' action = ''>"
+ "<p>"
+ "His daughter is always shy in ___ and she never dares to make a speech to ___."
+ "<br /><label><input type = 'radio' name = 'radiobutton' value = 'A'>"
+ "A.the public…the public"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'B'>"
+ "B.public…the public"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'C'>"
+ "C.the public…public"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'D'>"
+ "D.public…public"
+ "</label><br /></p></form>";
break; case 3:
document.getElementById("question" + count[controlNum]).innerHTML
= "<form id = 'Q3' action = ''>"
+ "<p>"
+ "Rose was wild with joy ___ the result of the examination."
+ "<br /><label><input type = 'radio' name = 'radiobutton' value = 'A'>"
+ "A.to"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'B'>"
+ "B.at"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'C'>"
+ "C.by"
+ "</label><br /><label><input type = 'radio' name = 'radiobutton' value = 'D'>"
+ "D.as"
+ "</label><br /></p></form>";
break;
}
}
//-->
</script>
</body>
</html>
解决方案 »
- 在focus时间修改className, 用户输入第一个字符不触发propertychange?IE bug?
- 求助js实现两个简单效果 1)闪烁 2)隐藏
- jsp中如何调用js,情况特殊请看代码
- 有人做过来源统计的么?问个问题
- 改变包含frame页的title
- 用javascript控制<div>的属性?
- 谁有显示倒计时的程序?
- 我希望这样,能实现吗?<form name="form1" method="post" action="test.jsp?¶=<script>form1.name1.value</script>">
- 关于直接弹出文件保存对话框的问题。。。
- 如何使按钮汉字居中?
- js怎样把字符串转换为数字,并计算其之和???在线等。
- asp.net(C#) 批量添加数据
controlNum在使用之前没有赋值