标签:
DOM document
操作页面的能力
获取元素:getElementByID() getElementsByTagName() getElementByClassName()
改变页面: innerHTML() ,oDiv.style.color(),
DOM树:
节点:文本节点,元素节点
获取节点
childNodes ,因为兼容问题,可用NodeType 判断; children ,则无兼容问题。
parentNode,offsetParent(实际位置);
firstChild,firstElementChild, lastChild,lastElementChild
兄弟节点:nextSibling,nextElementSibling; priviousSibling,priviousElementSibling;
创建节点,添加,删除,QQ邮箱文件上传;
createElement(标签名); appendChild(节点)ul 加li ;removeChild
Demo:前端 表格数据 搜索,将符合选项显示颜色。
window:所有浏览器都实现了window,document.--- 即window.document.---;
window.screen对象在编写时可以不使用 window 这个前缀。
window.navigator 对象包含有关访问者浏览器的信息。
navigator.appCodeName
navigator.appName
navigator.appVersion
navigator.cookieEnabled
navigator.platform
navigator.userAgent
navigator.systemLanguage
可以在 JavaScript 中创建三种消息框:警告框、确认框、提示框。
alert() confirm() window.prompt("sometext","defaultvalue");
要使用clearTimeout() 方法, 你必须在创建超时方法中(setTimeout)使用全局变量:myVar=setTimeout("javascript function",milliseconds);
Cookies
是一些数据, 存储于你电脑上的文本文件中。
当 web 服务器向浏览器发送 web 页面时,在连接关闭后,服务端不会记录用户的信息。
Cookies 的作用就是用于解决 "如何记录客户端的用户信息":
Cookies 以名/值对形式存储,如下所示:
标签:
原文地址:http://www.cnblogs.com/lls002-1435/p/5410857.html