利用js生成一个在线考试系统

本文分享了如何利用JavaScript创建一个在线考试系统。系统包括题目显示、倒计时功能、答案提交等关键部分,帮助用户完成在线答题并展示成绩。
摘要由CSDN通过智能技术生成

前些日子帮人做了一个在线考试系统,JS代码如下

 
  

<body>
<div id="content" style="display: none">
<p style="font-weight: 700"> 1,the questions mentioned above</p>
<p style="font-weight: 700"> 2,the timer counting frome 12-(60seconds*2)to 0 <span style="color: #FF4500"> TimeRemaining:</span><a style="font-weight: 600;" id="countdown"></a></p>

<table id="answer"></table>
<table id="dispute"></table>
<div>
</div>
<div style="margin-left: 100px;margin-top: 20px;"><input type="button" id="submitbtn" value="submit" οnclick="Submit()" /></div>
</div>

<div id="AnswerDiv" class="mydiv" style="display: none">
<p>
Your mark is :<span id="mark" style="color: red"></span>
</p>
<div id="correctAnswer" style="display: none">
<p>Correct Answer</p>
<ul id="correctAnswer_ul"></ul>
</div>
<p style="color:blue;display: none" id="allRight">good 100 !!!</p>
</div>
</body>



<script> //timer var timer = 120; var Time_kill; window.onload = function () { // if (confirm("Are you ready for the quiz? you need to submit in 120s.")) { // document.getElementById("content").style.display = "block"; // Quenstion1(); // document.getElementById("countdown").innerHTML = timer; // Time_kill = setInterval("Time_up()", 1000); // } document.getElementById("content").style.display = "block"; Quenstion1(); document.getElementById("countdown").innerHTML = timer; Time_kill = setInterval("Time_up()", 1000); };
//定时器
function Time_up() { if (timer == 0) { clearInterval(Time_kill); alert('The time expires~'); document.getElementById("submitbtn").disabled = "disabled"; return; } timer--; document.getElementById("countdown").innerHTML = timer; } var style1 = []; var style2 = []; var Answers = [ { Id: 1, Title: "Mary, your dress is really beautiful. How is John? ", mptions: { A: "Thank you very much", B: "No, no, John is not bad", C: "Thank you. He is fine", D: "Don’t say that. It’s ugly. John is good" }, Answer: "C", }, { Id: 2, Title: "— Mary, are you a
  • 0
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值