bom基础

来源:互联网 发布:钓鱼盗号软件 编辑:程序博客网 时间:2024/06/06 18:57
①window.open()
<span style="font-size:14px;"><!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title><script>window.onload=function(){var obtn=document.getElementById('btn1');obtn.onclick=function(){window.open('http://www.baidu.com','_blank');}}</script></head><body><input id="btn1" type="button" value="打开"/></body></html></span>

②document.write()

<span style="font-size:14px;"><!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title><script>window.onload=function(){var otxt=document.getElementById('txt1');var obtn=document.getElementById('btn1');obtn.onclick=function(){var newWin=window.open('about:blank');newWin.document.write(otxt.value);};};</script></head><body><textarea id="txt1" cols="30" rows="10"></textarea><input type="button" id="btn1" value="运行"></body></html></span>

③alert(window.location);//弹出当前文件地址

window.location('http://www.baidu.com');

④alert(window.navigator.userAgent);//弹出浏览器版本

⑤IE:screenLeft screenTop  FF:screenX screenY获取浏览器距离屏幕左边距离和上边距离

⑥document.documentElement.clientwidth;(火狐IE通用)        FF:window.innerWidth,window.innerHeight获取浏览器宽高

⑦窗体控制:moveBy(X,Y)沿着XY轴移动指定的像素   窗体尺寸:resizeBy(X,Y )

0 0
原创粉丝点击