js基础对象-编程模式与设计模式

来源:互联网 发布:apache和nginx用哪个 编辑:程序博客网 时间:2024/05/16 09:54

1.常用BOM

window.navigator

window.location 属性href hash host hostname pathname port protocal search

window.history history.forward() history.back() history.go(-1)  history.go(0)

window.frames获取当前页面是否存在frame元素,可以用索引来操作frames如window.frames[0] window.frames[0].window frames[0].window frames[0]如果frame元素 访问子frame元素属性,frames[0].window.location.reload()同时可以通过parent来访问父级页面,top属性可以访问顶级页面,self自身属性

screen包含浏览器以外的桌面信息

window.open() cloase()

window.moveTo() window.resizeTo() window.alert() window.prompt() window.confirm()

重要的两个时间函数

window.setTimeout() window.setInterval()

对应方法有clearTimeout() clearInterval()

document有的属性nodeType nodeName nodeText haschidNodes()判断是否有子节点

hasAttributes()方法检查该元素中是否存在属性

nextSiblng previousSibling树节点,firstChild lastChild两个属性

getElementsByTagName

DOM节点修改可以用nodeValue,innerHTML等

creatElement()和createTextNode()这两个方法创建新节点,appendChild()可以将新节点添加到DOM结构中

createTextNode创建文本节点

cloneNode()

insertBefore()

removeChild()


访问文档的基本方法

document.images

documentllinks

document.anchors

doucment.forms

获取当前页面的表单document.forms[0]

如果form有name属性的话,可以document.forms[0].elements['search']来查找

document.write()

Cookies Title Referrer Domain

addEventListener

停止冒泡:stopPropagation





编程模式

1.行为隔离

2.命名空间

var MYAPP=MYAPP || {};


0 0
原创粉丝点击