1.DOM
设置CSS样式
ele.style.stylename=styleValue;
ele为设置样式的DOM元素
stylename为样式名
styleValue为样式值
innerHTML
语法:ele.innerHTML
返回ele元素标签之间的HTML。
语法:ele.innerHTML="html"
设置ele元素标签之间的html内容。
className
语法:ele.className
返回ele元素的类名。
语法:ele.className="className"
设置ele元素的类名。
attribute
语法:ele.getAttribute("attribute")
获取ele元素的attribute属性;
语法:ele.setAttribute("attribute",value)
设置ele元素的attribute值。
语法:ele.removeAttribute("attribute")
删除ele的attribute属性。
2.事件
浏览器窗口或文档发生的一些特定的交互瞬间。
this指向
1.函数名前面有点就指向函数名前面的,没有点在非严格模式下指向window,严格模式下this为undefined。
2.构造函数指向他们的实例。
3.BOM
prompt(),comfirm()和alert()
语法:window.prompt("text","default");
点击取消返回null,点击确认返回输入框文字。
语法:confirm("message")
点击取消返回false,确认返回true
语法:alert("contant");
open()和close()
语法:window.open(pageURL,pagename,pagemeters)
打开一个新的浏览器窗口或查找一个已命名的窗口
语法:window.close()
关闭一个网页
setTimeOut()和setInterval()
location的常用属性
location.replace()和location.reloa()
history
语法:history.back()
返回历史记录的上一步
语法:history.forward()
到历史记录的下一步
语法:history.go(n)
n为正数:到历史记录的第n步
n为负数:返回历史记录的第n步
screen