1.Anchor对象2.Document对象3.Event对象4.Form,Inout对象5.Frame对象6.Image对象7.Location对象8.Navigator对象9.Option,Sel
.
1.Anchor对象 2.Document对象 3.Event对象 4.Form,Inout对象 5.Frame对象 6.Image对象 7.Location对象 8.Navigator对象 9.Option,Select对象 10.Screen对象 11.Table对象 12.Window对象 |
1.Anchor对象
修改 a 属性
function changeA(){ var tmp=documnent.getElementById('zcwA') tmp.innerHTML="切换到oxomsd" tmp.href="http://oxomsd.com" tmp.target="_blank"}
设定焦点、取消焦点
function getFocus() { var tmp=document.getElementById('handFocus') tmp.focus()}function loseFocus() { var tmp=document.getElementById('handFocus') tmp.blur()}
为超链接添加快捷键(eg: Alt+F,安装linux时常常可以在鼠标还卡的时候快速操作)
function accessKey(){ var tmpN=document.getElementById('buttonNext') var tmpP=document.getElementById('buttonPrevious') tmpN.accessKey='n' tmpP.accessKey='p'}
2.Document对象
添加文本内容(第三行)
<div id="w" style="height: 222px; width: 330px; background-color: #808080; padding: 50px;"> <script type="text/javascript"> document.write('买保险没有? 没买保险上路不保险,至少要有个交强险啊!') </script></div>
添加 html 风格的的内容
document.write('<h2>买保险没有?</h2> <p> 没买保险上路不保险,至少要有个交强险啊!</p>')
获取文档标题(html文件的titile标签文本)
document.write(document.title)
当前文档的url
document.write(document.URL)
获取文档的 referrer(从a标签文档跳转过来时,获取a文档路径)
<a href="http://127.0.0.1:8020/Labs/writeByJavascript.html?__hbt=1508923381436" target="_blank">test</a>
<div style="border: solid"> <p>referrer </p> <script type="text/javascript"> document.write(document.referrer) </script></div>
3.Event对象
4.Form,Inout对象
5.Frame对象
6.Image对象
7.Location对象
8.Navigator对象
9.Option,Select对象
10.Screen对象
11.Table对象
12.Window对象
.