javasprict中Document对象

           Document对象 在javasprict中比较重要,几乎所有的操作都是对Document和window两个对象进行操作,现先把我自己学的Document一些东西和大家分享一下,有什么问题一定要提出来哦。

Document对象可以更新正在装入或已经装入的文档,并可以访问装入文档所包含的HTML元素,Document对象是一个顶层对象,不需要预先实例化可直接使用。

 

Document属性

form属性:通过document.Forms[]数组来使得在同一个页面上可以有多个相同的表单窗体,使用forms[]    

                      数组比使用表单名字方便,即Document.form[n]Document.formName)。

 

             eg

<form name="frm1">

   textbox1:<input type="text" width="279" onChange="document.my.elements[0].value=this.value;">

</form>

 

<form name="my">

    textbox2:<input type="text" width="279" onChange="document.frm1.elements[0].value=this.value;">

</form>

 

 

titile属性:使用document.title可以得到当前页面中包含在<title>对中的标题

URL属性:使用document.URL可以得到当前网页的路径。

Open()Close()方法:window一样。

Write()writeln()方法:

 

 

 

 

                                                           DOcument对象的集合:

集合

说明

anchors

页面中所有锚的集合(由<a name="anchorname"></a>表示)

applets

页面中所有applet的结合

embeds

页面中所有嵌套式对象的集合(<embed/>标签表示)

forms

页面中有表单的集合

images

页面中所有图像的集合

links

页面中所有链接的集合(<a href="somewhere.htm"></a>表示)

location对象

原文地址:https://www.cnblogs.com/fanchangfa/p/2133129.html