注:将下面一段代码在整个页面加载完成后执行!!!
自定义实现onchange事件!!!
<script>
function LoadEvent(func)
{
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
function DateSelectChange()
{
var count=0;
var count_End=0;
var count_End1=0; //以上3个变量:控制页面第一次加载的时候不执行function
var IDs=document.getElementById("栏位名称");
IDs.onpropertychange=function(){
count++;
if(count>1)
{
//要执行的function
}
}
IDs=document.getElementById("栏位名称");
IDs.onpropertychange=function(){
count_End++;
if(count_End>1)
{
//要执行的function
}
}
IDs=document.getElementById("栏位名称");
IDs.onpropertychange=function(){
count_End1++;
if(count_End1>1)
{
//要执行的function
}
}
}
LoadEvent(DateSelectChange);
</script>