Copy the code code as follows:
<script language="javascript" type="text/javascript">
var firsty;//The year and month when the page was first loaded
var firstm;
var secondy;//The value when onchange is triggered
var secondm;
var panduan=0;//Judge whether it has changed or not
function onloadload()//Assign an initial value to the global variable and call <body onload="onloadload()"> in the page onload event
{
firsty = document.getElementById("txtYear").value;//The first year and month when loading the page
firstm = document.getElementById("txtMonth").value;
secondy = document.getElementById("txtYear").value;//The value when onchange is triggered
secondm = document.getElementById("txtMonth").value;
}
function changeym()//Triggered when the focus is lost, determine whether there is any change onfocusout="changeym();"
{
secondy = document.getElementById("txtYear").value;
secondm = document.getElementById("txtMonth").value;
if(parseInt(secondy,10) != parseInt(firsty,10) || parseInt(secondm,10) != parseInt(firstm,10))//The reason for the conversion is to take into account the difference between months 3 and 03
{
panduan=1;//There are changes
alert('Retrieve data!');
document.getElementById("btnCurPayLoad").click();
}
else
{
firsty=secondy;//Assignment, in order to change after the change
firstm=secondm;
}
}
</script>