<%@ page language="java" import="java.util.*" pageEncoding="gbk"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> </head> <!-- XML DOM nextSibling 属性 || javascript nextSibling reference: <[http://www.cnblogs.com/Dannier/archive/2012/04/19/2456839.html]> reference: <[http://www.w3school.com.cn/xmldom/prop_element_nextsibling.asp]> 其中nodeType的值主要有以下几种: 1.元素节点的nodeType值为1 2.属性节点的nodeType值为2 3.文本节点的nodeType值为3 document.all //ie only usage: <[document.all.queryFrm.submit();]> 访问页面dom元素:document.all[index/id/name]可通过索引号 id值 name(表单元素)访问到对应的某个DOM元素 document.all.item(id/name) -> item()方法来获取集合中的元素 document.all.tags("div") -> tags()方法返回某个标签的元素数组 document.all的意思是文档的所有元素,也就是说它包含了当前网页的所有元素.它是以数组的形式保存元素的属性的, 所以我们可以用 document.all["元素名"].属性名="属性值"来动态改变元素的属性.用这条语句,可以做出许许多多 动态网页效果,如:动态变换图片、动态 改变文本的背景、动态改变网页的背景、动态改变图片的大小、动态改变文 字的大小各颜色等等.你简直可以动态控制所有网页元素.document.all[]这个数组可以访问文档中所有元素 怎么访问一个特定的元素,例如文档中有一个DIV,<div id="docid" name="docname"></div>, 可以通过这个DIV的ID,NAME 或INDEX属性访问这个DIV: document.all['docid'] document.all['docname'] document.all.item('docid') document.all.item('docname') document.all[7] document.all.tags("div")则返回文档中所有DIV数组,只有一个DIV,所以用 document.all.tags("div")[0] document.all.length=19 document.all[0]=! document.all[1]=HTML document.all[2]=HEAD document.all[3]=TITLE document.all[4]=BASE document.all[5]=! document.all[6]=BODY document.all[7]=H1 document.all[8]=HR document.all[9]=P document.all[10]=EM document.all[11]=EM document.all[12]=P document.all[13]=EM document.all[14]=P document.all[15]=EM document.all[16]=EM document.all[17]=HR document.all[18]=SCRIPT --> <body onload="bgcolor();"> <h1>Example Heading</h1><hr /> <p>This is a <em>paragraph</em>. It is only a <em>paragraph.</em></p> <p>Yet another <em>paragraph.</em></p> <p>This final <em>paragraph</em> has <em id="special">special emphasis.</em></p><hr /> <script type="text/javascript"> var i,origLength; origLength = document.all.length; document.write('document.all.length='+origLength+"<br />"); for (i = 0; i < origLength; i++) { document.write("document.all["+i+"]="+document.all[i].tagName+"<br />"); } </script> <h1 id="heading1" align="center" style="font-size: larger;">DHTML Fun!!!</h1> <form name="testform" id="testform" action="#" method="get"> <input type="button" value="Red" onclick="document.all['heading1'].style.color='red';" /> <input type="button" value="Blue" onclick="document.all['heading1'].style.color='blue';" /> <input type="button" value="Black" onclick="document.all['heading1'].style.color='black';" /> </form> </body> </html> <script language="javascript" type="text/javascript"> function bgcolor() { document.all[7].style.backgroundColor="#ffccff"; } </script>
相关推荐
1、理解document.all[] 从IE4开始IE的object model才增加了document.all[],来看看document.all[]的Description: Array of all HTML tags in the document.Collection of all elements contained by the object. ...
JS中关于document.all的详解
JS:document.all的用法
一. document.all是页面内所有元素的一个集合。例如: document.all(0)表示页面内第一个元素 二. document.all可以判断浏览器是否是IE if(document.all){ alert(... [removed] alert(document.all.aaa.v
jsDocument
1、DOM WEB标准现在可真是热门中热门,不过下面讨论的是一个不符合标准的document.all[]。DOM--DOCUMENT OBJECT MODEL文档对象模型,提供了访问文档对象的方法.例如文档中有一个table,你要改变它的背景颜色,那...
document.getElementById 是公共标准,被目前的所有主流浏览器支持,document.all只有IE支持,document.layers是Netscape 4.x专有的属性
DOM对象中document.all显示全部html标记集合.为网页版,打开后,右击,显示源码ok
另外,input等如果作为form的子元素,则直接用inputName或者document.inputName来引用此对象就是错误的,必须使用formName.inputName引用,否则就可以使用inputName来引用. 另外应该注意到有很多平时用的元素都没有...
document.all想必学习javascript的同学们都很了解吧,本文主要是针对一些刚入门的童鞋们做一下有关document.all的相关总结,感兴趣的朋友可以了解下,或许本文对你有所帮助
Document.all[]是文档中所有标签组成的一个数组变量,包括了文档对象中所有元素
NULL 博文链接:https://rebecca.iteye.com/blog/1173548
我们来看: oEle= document.all.aaa ;//这里有一个aaa的对象,但我们不知道它现在长度是多少,所以没办法对它操作.因此,我们要先做判断长度的过程.如下: if(oEle.length){}else{}; 在两种情况下,花括号里面的内容写法...
– if(document.all) alert(“this is a IE”); else alert(“this is a Mozilla”); //–> [removed] </body> </html> 在IE浏览器会输出 “this is a IE”; 而在firefox浏览器中会...
解决 firefox 不支持 document.all的方法
另外,input等如果作为form的子元素,则直接用inputName或者document.inputName来引用此对象就是错误的,必须使用formName.inputName引用,否则就可以使用inputName来引用. 另外应该注意到有很多平时用的元素都没有name...