<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>测试</title>
<SCRIPT language="JavaScript">
function show() {
var str = "";
str = str + panduan("score", 0, "第一题回答");
str = str + panduan("score2", 2, "第二题回答");
str = str + panduan("score3", 2, "第三题回答");
str = str + panduan("score4", 0, "第四题回答");
str = str + panduan("score5", 0, "第五题回答");
str = str + panduan("score6", 2, "第六题回答");
str = str + panduan("score7", 3, "第七题回答");
str = str + panduan("score8", 2, "第八题回答");
str = str + panduan("score9", 2, "第九题回答");
str = str + panduan("score10", 1, "第十题回答");
alert(str);
}
function panduan(name, daan, xinxi) {
var jieguo = "";
var jieguo1 = document.getElementsByName(name);
if (jieguo1[daan].checked == true) {
jieguo = jieguo + xinxi + "正确。\n";
} else {
jieguo = jieguo + xinxi + "错误。\n";
}
return jieguo;
}
</SCRIPT>
</head>
<body>
<p>1.写“Hello World”的正确javascript语法是?().</p>
<form>
<input type="radio" name="score" value="1"/> document.write("Hello World")
<input type="radio" name="score" value="2"/>B. "Hello World"
<input type="radio" name="score" value="3"/>C. response.write("Hello World")
<input type="radio" name="score" value="4"/>D. ("Hello World")
</form>
<br /><br />
<p>2.产生当前日期的方法是 </p>
<form>
<input type="radio" name="score2" value="1"/>A.Now();
<input type="radio" name="score2" value="2"/>B.Date()
<input type="radio" name="score2" value="3"/>C.new Date()
<input type="radio" name="score2" value="4"/>D.new Now()
</form>
<br /><br />
<p>3.在HTML文档对象模型中,history对象的()用于加载历史列表中的下一个URL页面。 </p>
<form>
<input type="radio" name="score3" value="1"/>A.next()
<input type="radio" name="score3" value="2"/>B.back()
<input type="radio" name="score3" value="3"/>C.forward()
<input type="radio" name="score3" value="4"/>D.go(-1)
</form>
<br /><br />
<p>4、在Javascript浏览器对象模型中,window对象的()属性用来指定浏览器状态栏中显示的临时消息。 </p>
<form>
<input type="radio" name="score4" value="1"/>A.status
<input type="radio" name="score4" value="2"/>B.screen
<input type="radio" name="score4" value="3"/>C.history
<input type="radio" name="score4" value="4"/>D.document
</form>
<br /><br />
<p>5、在Javascript中,可以使用Date对象的()方法返回一个月中的每一天。 </p>
<form>
<input type="radio" name="score5" value="1"/>A.getDate
<input type="radio" name="score5" value="2"/>B.getYear
<input type="radio" name="score5" value="3"/>C.getMonth
<input type="radio" name="score5" value="4"/>D.getTime
</form>
<br /><br />
<p>6、在Javascript中要改变页面文档的背景色,需要修改document对象的()属性。 </p>
<form>
<input type="radio" name="score6" value="1"/>A.BackColor
<input type="radio" name="score6" value="2"/>B.BackgroundColor
<input type="radio" name="score6" value="3"/>C.BgColor
<input type="radio" name="score6" value="4"/>D.Background
</form>
<br /><br />
<p>7、在HTML页面中,不能与onChange事件处理程序相关联的表单元素有 </p>
<form>
<input type="radio" name="score7" value="1"/>A.文本框
<input type="radio" name="score7" value="2"/>B.复选框
<input type="radio" name="score7" value="3"/>C.列表框
<input type="radio" name="score7" value="4"/>D.按钮
</form>
<br /><br />
<p>8、下列选项中关于浏览器对象的说法错误的是 </p>
<form>
<input type="radio" name="score8" value="1"/>A.history对象记录了用户在一个浏览器中已经访问过的URLs
<input type="radio" name="score8" value="2"/>B.location对象相当于IE浏览器中的地址栏,包含关于当前URL地址的信息
<input type="radio" name="score8" value="3"/>C.location对象是history对象的父对象
<input type="radio" name="score8" value="4"/>D.location对象是window对象的子对象
</form>
<br /><br />
<p>9、Javascript中制作图片代替按钮的提交效果需要手动提交方法submit(),以下调用正确的是</p>
<form>
<input type="radio" name="score9" value="1"/>A.submit();
<input type="radio" name="score9" value="2"/>B.myform.submit()
<input type="radio" name="score9" value="3"/>C.document.myform.submit()
<input type="radio" name="score9" value="4"/>D.window.myform.submit();
</form>
<br /><br />
<p>10、某网页中有一个窗体对象,其名称是mainForm,该窗体对象的第一个元素是按钮,其名称是myButton,表述该按钮对象的方法是 </p>
<form>
<input type="radio" name="score10" value="1"/>A.document.forms.myButton
<input type="radio" name="score10" value="2"/>B.document.mainForm.myButton
<input type="radio" name="score10" value="3"/>C.document.forms[0].element[0]
<input type="radio" name="score10" value="4"/>D.以上都可以
<INPUT TYPE="button" onclick="show();" value="提交">
</form>
<br /><br />
<button id="button">得分是</button>
<script type="text/javascript">
var sco = document.getElementsByTagName("input");
var butn = document.getElementById("button");
butn.onclick = function () {
var gec = 0;
for (var i = 0; i < sco.length; i++) {
if (sco[i].checked == true) {
var sc = parseInt(sco[i].value);
gec += sc;
}
}
alert(gec);
}
</script>
</body>
</html>
我只能做这种弹出提示框的 不能把分数和相应错题答案连接到新窗口