Home  >  Article  >  Web Front-end  >  javascript的BOM汇总_javascript技巧

javascript的BOM汇总_javascript技巧

WBOY
WBOYOriginal
2016-05-16 15:49:58868browse

setTimeout()  //延时器,只执行一次代码

clearTimeout()  //清除演示器

setIntervla()  //定时器,根据指定时间间隔执行一次代码

clearInterval()  //清除定时器

window.history.length  //访问的历史页面的数目

window.history.forward()  //前一页

window.history.back();  //后一页

window.history.go(-1);  //跳转至曾经访问过的某个页面,负值表示向后跳

document.referrer//需要将两个文件放在服务器中才能得到想要的结果,若直接在本地文件夹中则得到空字符串,若直接在浏览器地址栏中输入b.html的URL地址或使用打开菜单访问b.html,则document.referrer的值为空字符串。 
window.moveBy   //by是相对的意思(从原先的位置而言)

window.moveTo  //to是绝对的意思(从整体而言)

window.moveTo  //把窗口大小调整为指定的宽度和高度。

window.resizeBy  //把窗口大小增加或减小指定的宽度和高度

window.screenLeft/window.screenX  //与屏幕左侧的距离

window.screenTop/window.screenY  //与屏幕顶部的距离

注:

浏览器窗口位置:
IE、Chrome、Safari、Opera 都提供了支持 window.screenLeft 和 window.screenTop,但是Firxfox不支持这个两个属性;
Firxfox、Chrome、Safari、Opera 都提供了支持 window.screenX 和 window.screenY,但是 IE 不支持这个两个属性;

document.body.offsetHeight/document.body.clientHeight  //内容高度(body的高度)
window.innerHeight    //Chorm下使用
document.documentElement.clientHeught  //浏览器的可视高度
document.documentElement.scrollHeight  //内容的高度(HTML的高度)
document.documentElement.scrollTop  //滚动条滚动的高度

window.open  //打开一个新窗口
window.close  //关闭窗口
window.defaultStatus/window.Status  //状态栏信息
注:window.status  获取的是脚本赋予的临时值。window.defaultStatus   获取的是默认值。

document.lastModified  //返回文档最后修改时间
document.referrer    //退回浏览器历史中的上一个位置的URL
document.title    //返回当前页面内title标签内显示的文本
document.URL    //返回当前页面的URL
document.anchors[0].innerHTML  //页面内第一个锚点的内容
location.reload(false)    //该方法强迫浏览器刷新当前页面
navigator.appCodeName    //申明浏览器的代码名
navigator.appVirson    //返回浏览器的平台和版本信息。该属性是一个只读的字符串
eval    //可以处理一段由字符串表示的JS代码
encodeURI    //编码
decodeURI    //解码

以上所述上就是本文的全部内容了,希望大家能够喜欢。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn