qq_27073577 2015-12-30 00:23 采纳率: 0%
浏览 2358

怎么计算选择题分数 不会跳转显示所有答案页面和分数计算

图片说明

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


测试
<br> function show() {<br> var str = &quot;&quot;;<br> str = str + panduan(&quot;score&quot;, 0, &quot;第一题回答&quot;);<br> str = str + panduan(&quot;score2&quot;, 2, &quot;第二题回答&quot;);<br> str = str + panduan(&quot;score3&quot;, 2, &quot;第三题回答&quot;);<br> str = str + panduan(&quot;score4&quot;, 0, &quot;第四题回答&quot;);<br> str = str + panduan(&quot;score5&quot;, 0, &quot;第五题回答&quot;);<br> str = str + panduan(&quot;score6&quot;, 2, &quot;第六题回答&quot;);<br> str = str + panduan(&quot;score7&quot;, 3, &quot;第七题回答&quot;);<br> str = str + panduan(&quot;score8&quot;, 2, &quot;第八题回答&quot;);<br> str = str + panduan(&quot;score9&quot;, 2, &quot;第九题回答&quot;);<br> str = str + panduan(&quot;score10&quot;, 1, &quot;第十题回答&quot;);<br> alert(str);<br> }</p> <pre><code> function panduan(name, daan, xinxi) { var jieguo = &quot;&quot;; var jieguo1 = document.getElementsByName(name); if (jieguo1[daan].checked == true) { jieguo = jieguo + xinxi + &quot;正确。\n&quot;; } else { jieguo = jieguo + xinxi + &quot;错误。\n&quot;; } return jieguo; } </code></pre> <p>

1.写“Hello World”的正确javascript语法是?().

document.write("Hello World") B. "Hello World" C. response.write("Hello World") D. ("Hello World")



2.产生当前日期的方法是

A.Now(); B.Date() C.new Date() D.new Now()



3.在HTML文档对象模型中,history对象的()用于加载历史列表中的下一个URL页面。

A.next() B.back() C.forward() D.go(-1)



4、在Javascript浏览器对象模型中,window对象的()属性用来指定浏览器状态栏中显示的临时消息。

A.status B.screen C.history D.document



5、在Javascript中,可以使用Date对象的()方法返回一个月中的每一天。

A.getDate B.getYear C.getMonth D.getTime



6、在Javascript中要改变页面文档的背景色,需要修改document对象的()属性。

A.BackColor B.BackgroundColor C.BgColor D.Background



7、在HTML页面中,不能与onChange事件处理程序相关联的表单元素有

A.文本框 B.复选框 C.列表框 D.按钮



8、下列选项中关于浏览器对象的说法错误的是

A.history对象记录了用户在一个浏览器中已经访问过的URLs B.location对象相当于IE浏览器中的地址栏,包含关于当前URL地址的信息 C.location对象是history对象的父对象 D.location对象是window对象的子对象



9、Javascript中制作图片代替按钮的提交效果需要手动提交方法submit(),以下调用正确的是

A.submit(); B.myform.submit() C.document.myform.submit() D.window.myform.submit();



10、某网页中有一个窗体对象,其名称是mainForm,该窗体对象的第一个元素是按钮,其名称是myButton,表述该按钮对象的方法是

A.document.forms.myButton B.document.mainForm.myButton C.document.forms[0].element[0] D.以上都可以




得分是

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); }



如果按一题10分计算 这个计算代码该如何写

  • 写回答

6条回答 默认 最新

  • ITDragon龙 2015-12-30 00:55
    关注

    给你一个参考资料,是购物车自动结算功能,不跳转页面显示分数http://blog.csdn.net/qq_19558705/article/details/50364678

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器