<div class="codetitle"> <span><a style="CURSOR: pointer" data="82427" class="copybut" id="copybut82427" onclick="doCopy('code82427')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code82427"> <br><script type="text/javascript"> <BR>function (){ <BR>//開始時間比結束時間大的驗證<BR>var validtime = document.form1.validtime.value; <BR>var invalidtime = document.form1.invalidtime.value; <BR>var beginTimes=var beginTimes=var beginTimes=var beginTimes=var beginTimes=var beginTimes=var beginTimes=var beginTimes=var beginTimes= validtime.substring(0,10).split('-'); <BR>var endTimes=invalidtime.substring(0,10).split('-'); <BR>validtime=beginTimes[1] '/' beginTimes[2] '/' beginTimes[0] '/' validtime.substring(10,19); <BR>invalidtime=endTimes[1] '/' endTimes[2] '/' endTimes[0] '/' invalidtime .substring(10,19); <BR>var a =(Date.parse(invalidtime)-Date.parse(validtime))/3600/1000; <BR>if(a<0){ <BR>alert("失效時間不能小於生效時間!"); <BR>return; <BR>} <BR>var emergency = document.form1.emergency.value; <BR>if(emergency==""||regnull.test(emergency )){ <BR>alert("請輸緊急程度!"); <BR>document.form1.emergency.focus(); <BR>return; <BR>} <BR>document.form1.submit(); <BR>} <BR><script> <BR></script> </div>