SecondaryTime 的值 - PrimaryTime 的值
答案将放在 Sp 文本字段中。
时间格式为 HH:MM:SS
帮助!!:))
<SCRIPT language="javascript">
function calculate(time1,time2){
var diff = Math.abs(time1 - time2);
document.form.Sp.value = diff;
}
</script>
<form name="form1" method="post" action="">
<label for="PrimaryTime"></label>
<input type="text" name="PrimaryTime" id="PrimaryTime">
<label for="SecondaryTime"></label>
<input type="text" name="SecondaryTime" id="SecondaryTime" onFocus = "calculate(this.form.SecondaryTime.value, this.form.PrimaryTime.value)>
<label for="Sp"></label>
<input name="Sp" type="text" id="Sp" readonly="readonly">
</form>