//1、当页面滚动条变化时
var timeout = false;
$(window).scroll(function(){
if (timeout){clearTimeout(timeout);}
timeout = setTimeout(function(){
// dosomething
},100);
}
);
// 2、鼠标点击页面上任意位置
document.onclick = function(event){
event = event? event: window.event;
var obj = null;
// 先判断事件是否发生在指定目标上,若否,则执行something
// ie
if(navigator.userAgent.indexOf("MSIE")>0)
{
obj = event.toElement;
while( obj!=null && obj.id!="leftDivMenu" )
{
obj = obj.parentElement;
}
}
//firefox
if(navigator.userAgent.indexOf("Firefox")>0)
{
obj = theEvent.relatedTarget;
while( obj!=null && obj.id!="leftDivMenu" )
{
obj = obj.parentNode;
}
}
//执行
if( obj==null )
{
//dosomething
}
};
// 3、给iframe添加事件监听,鼠标点击时,dosomething
function init()
{
if( contentFrame.document.readyState == "complete" ){
contentFrame.document.onclick = dosomething();
return;
}
window.setTimeout("init();",100);
}