The sourceIndex PropertyIn 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
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> |