The sourceIndex Property


The sourceIndex Property

In the Internet Explorer, the sourceIndex property returns the numeric index of an object in the all collection. You can see the support for this property in Table 5.52.

Table 5.52. The sourceIndex Property

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

sourceIndex

           

x

x

x

x

 

Read-only

 

Type: Integer

Here's an example where I find the numeric index of a text field, and then use that index in the document.all collection to get the text from the text field:

(Listing 05-20.html on the web site)
 <HTML>      <HEAD>          <TITLE>Using the sourceIndex Property</TITLE>      </HEAD>      <BODY>          <H1>Using the sourceIndex Property</H1>          <INPUT ID="text1" TYPE="TEXT" VALUE="Hello!">          <SCRIPT LANGUAGE="JavaScript">              <!--  document.write("<BR>The text is: " +   document.all[document.getElementById("text1").sourceIndex].value)  // -->          </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