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

    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?