//获取屏幕可视区域的宽高(仿jQuery)function client(){
if(window.innerHeight !== undefined){
return {
"width": window.innerWidth,
"height": window.innerHeight
}
}else if(document.compatMode === "CSS1Compat"){
return {
"width": document.documentElement.clientWidth,
"height": document.documentElement.clientHeight
}
}else{
return {
"width": document.body.clientWidth,
"height": document.body.clientHeight
}
}
}//阻止时间冒泡var box = document.getElementById("box");
box.onmouseover = function (event) {
console.log("鼠标放到了box上");
//阻止冒泡
event = event || window.event;
if(event && event.stopPropagation){
event.stopPropagation();
}else{
event.cancelBubble = true;
}
}//捕获时间对象(兼容性写法)box.οnclick=function(event){event=event=||window.event;var aaa=event.target?event.target:event.srcElement;}
转载于:https://www.cnblogs.com/vzaiBoke/p/9032144.html