JS实现考试题目系统倒计时自动交卷(转载)
自动交卷JS代码(微改)
目前为60分钟自动执行BT_JJ(Button)按钮点击事件,时间显示在LB_JS(Label)中
<script type="text/javascript">
var sec=0;
var min=0;
var hou=0;
flag=0;
idt=window.setTimeout("ls();",1000);
function ls()
{
sec++;
if(sec==60){sec=0;min+=1;}
if(min==60){min=0;hou+=1;}
document.getElementById("LB_JS").innerText=min+"分"+sec+"秒";
idt=window.setTimeout("ls();",1000);
if(min==60)
{
document.getElementById("BT_JJ").click();
clearTimeout(idt);
}
}
</script>
<div id="div1" runat="server" style="width: 150px;height: 100px;background: white;position: absolute;bottom: 0px;right: 0px;">
计时:<asp:Label ID="LB_JS" runat="server" Text=""></asp:Label>
</div>
转载自https://zhidao.baidu.com/question/235436912.html