<html>
<head>
</head>
<body>
<input type="text" name="mss" id="mss" />
<form action=" ">
<input type="text" value="name" name="name" />
</form>
<body>
</html>
<script type="text/javascript">
window.onload = function() {
daojishi();
}
var counttime = 60 * 90;//把90分鐘化成總秒數
function daojishi() {
if (counttime >= 0) {
var seconds = counttime % 60;//得到剩餘的秒數 89%60==29秒
var min = Math.floor(counttime / 60);//分鐘
if (min >= 60) {
var hour = Math.floor(min / 60);
min = Math.floor((counttime - hour * 60 * 60) / 60);
document.getElementById("mss").value = hour + "小時" + min + "分"
+ seconds + "秒數";
} else if (mis >= 1) {
document.getElementById("mss").value = min + "分" + seconds
+ "秒數";
} else {
document.getElementById("mss").value = seconds + "秒數";
}
counttime--;
vartt = window.setTimeout("daojishi()", 1000);
} else {
window.clearTimeout(vartt);
window.confirm("考試時間結束,請單擊提交");
tijiao();
}
}
function tijiao() {
document.forms[0].submit();
}
//-->
</script>