複製程式碼 程式碼如下: <br><br> var firsty;//最開始的載入頁時年和月<BR> var firstm;<當🎜><br> var secondytm;<當機觸發後的值secondm;<br> var panduan=0;//判斷改變了沒有<BR><BR> function onloadload()//為全域變數賦原值在頁面onload事件中呼叫<body onload="onloadload()"> <br> {<br> firsty = document.getElementById("txtYear").value;//最開始的載入頁面時年和月<BR>txt <BR> secondy = document.getElementById("txtYear").value;//當onchange觸發後的值<BR> <br> <br> <BR> function changeym()//焦點失去時觸發,判斷有沒有變化onfocusout="changeym();"<BR> { ondm = document.getElementById("txtMonth").value;<P> if(parseInt(secondy,10) != parseInt(firsty,10) || parseInt(secondm,10) != parsersty,10) || parseInt(secondm,10)之所以轉換是考慮到了月份3和03的差異 {<P> panduan document.getElementById("btnCurPayLoad" ).click();<BR> }<BR> else<BR> 變化<BR> firstm=secondm;<BR> }<BR> }<BR> <BR>