The all Property


The all Property

In the Internet Explorer, the all collection for an HTML element is the same as the all collection for the document objectit holds the elements the HTML element contains. You can see the support for the all property in Table 5.5.

Table 5.5. The all Property

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

all

           

x

x

x

x

 

Read-only

 

Type: Object array

As with the document.all collection, you can access any item by ID like this: all("myID") ( all["myID"] also works). Here's an example; in this case, I'm displaying all the properties in the all collection of a formnot only are the two HTML elements, button1 and text1 , displayed when you load this page, but so is the all collection's length property, which gives the number of items in the collection:

(Listing 05-02.html on the web site)
 <HTML>      <HEAD>          <TITLE>Using the all Property</TITLE>      </HEAD>      <BODY>          <H1>Using the all Property</H1>          <FORM NAME="form1">              <INPUT TYPE="BUTTON" ID="button1" ONCLICK="alert('Hello!')" VALUE="Click graphics/ccc.gif Me!">              <INPUT TYPE="TEXT" ID="text1" VALUE="Click Me!">          </FORM>       <SCRIPT LANGUAGE="JavaScript">          <!--  for(var obj in document.form1.all){   alert(obj)   }  // -->          </SCRIPT>      </BODY>  </HTML> 


Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net