BOM

什么是BOM?

BOM是bowser,object,model的缩写,称浏览器对象模型。

DOM针对的是文字本身,而BOM针对的是浏览器本身。

以下是几项简单的BOM事件

txt.onchange =function(){
alert();
}
txt.onblur(失去焦点)=function(){
    alert(this.value(这个.值));
}
txt.onkeyup(按键弹起)=function(){
    alert(按键弹起);
}
txt.onmouseover(鼠标移动上去)=function(){
    alert(鼠标移上去);
}
txt.onmouseleave(鼠标移开)=function(){
    alert(鼠标移开);
}
txt.onmousemove(鼠标移动)=function(){
    alert(windows.event.pageX);
    或者是可以打开调试:
    console.log(“X=”+window.event.pagX);
    console.log(“Y=”+window.event.pagY);
}

window.onresize(窗口改变)=function(){
    alert(123);
}
window.onscroll(检测滚动条)=function(){
    alert(window.scrollY);
}
window.setTimeout(延迟执行)(abc,毫秒);
function abc (){
    alert(123);
}
var x = window.setInterval(间隔执行)(abc,毫秒);
window.clearInterval(X);
原文地址:https://www.cnblogs.com/xinchenhui/p/7608635.html