JS
window对象
setInterval() 定时器
clearInterval() 清除 定时器
setTimeout() 延时函数
cleartimeout() 清除延时函数
window.open() 打开网页
window.close() 关闭网页
loation 对象
用于获得当前页面的地址 (URL),并把浏览器重定向到新的页面
location.pathname 文件所在路径
location.href 以当前页面打开新页面
location.reload(true) 重新请求服务器加载 传入false代表浏览器缓存中加载
location.assign() 新页面 会增加历史记录
location.replace() 打开页面 不会增加历史记录
history对象
包含用户(在浏览器窗口中)访问过的 URL
history.back() 后退
history.forward()前进
history.go(-2) 往后走2个
screen 对象
screen.height //屏幕高度
screen.width //屏幕宽度
screen.availHeight //屏幕实际高度
screen.availWidth //屏幕实际宽度
document.body.clientHeight 视窗的高度
document.body.scrollHeight 网页的总高度
document对象
document.title
document.URL
document.cookies
document.body
document.write() 动态向页面写内容
innerHTML
innerText
属性
attributes
getAttribute(属性名)
setAttribute(属性名,属性值)
setAttributeNode(Attr)
removeAttribute
元素
createElement
appendChild 拼接到末尾
insertBefore(新元素,对照元素) 插入到对照元素前
replaceChild 替换元素
removeChild()
子节点
chilidNodes 所有子节点
firstChild
lastChild
previousSibling
nextSibling
nodeType
子元素
chlidren 获取所有子元素
firstElementChild
lastElementChild
previousElementSibling
nextElementSibling
element.scrollIntoView(true); 滚动条滚动到元素上边界对齐 false代表下边界
window.scrollBy(x,y); 滚动条滚动 偏移量
window.scrollTo(x,y); 滚动条滚动到 某个位置
事件
onfocus 获取焦点
onblur 失去焦点
onClick
onDblClick
onmouseover 鼠标移入
onmouseout 鼠标移出
onmousemove 鼠标移动
onmousedown
onmouseup 鼠标按下和松开
onsubmit 表单提交