1. 利用DOM模型查找html元素:
HTML DOM 结构:
HTML
HTML.head
HTML.head.title
HTML.body
HTML.body.a.href
HTML.body.h1
Document.getElement.ById(’myAhchor‘).innerHTML = "NEW CONTENT"; 改变 标签中间 的文本;
Document.getElement.ById(’myAhchor‘).href= "/index.html"; 改变 标签 的 链接属性;
Document.myForm.txtCount.value //得到 文本框 的值;
Document.write();//add content
document.body.scrollTop // 页面已经下拉的距离。
2. 使用window对象open()方法制作各种广告
window 对象包括document对象和history,location;
window.document
window.status//状态栏中的信息
window.screen//客户端屏幕和现实性能的信息
window.history//客户访问过的URL信息
open("url",name);//打开具有指定名称的新窗口;
close(); //关闭当前窗口;
showModalDialog("register.html");
3. Date;setTimeout();
var today = new Date();
today.getHours();//return int;
today.getYear();//return int;
today.getDate();//return int;
today.getDay();//return int; 每周的第几天!
setTimeout(“function1()”,1000);
4. History
history.back();//后退
history.forward();//前进
5. DIV
div1.style.display="none";//隐藏一层;
.visibility:
.visible(默认)
.hidden(不可见),设为hidden是元素看不见但是尺寸仍然在
.display:
inline
block
none