★ wanayoo — archive 1999 http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/sourceIndex.aspNouvelle recherche | Portail wanayoo
MSDN Online Web Workshop   All Products  |   Support  |   Search  |   microsoft.com Home  
microsoft.com Home
  HOME  |   VOICES  |   LIBRARIES  |   COMMUNITY  |   DOWNLOADS  |   SITE GUIDE  |   SEARCH MSDN
 
Click to return to the DHTML, HTML & CSS home page  
SIZE Attribute | size Pro...     SPAN Attribute | span Pro...     DHTML Properties    
Web Workshop  |  DHTML, HTML & CSS

sourceIndex Property


Retrieves the ordinal position of the object, in source order, as the object appears in the all collection.

Syntax

HTMLN/A
Scripting[ iIndex = ] object.sourceIndex

Possible Values

iIndexObject that specifies the ordinal position.

The property is read-only with no default value.

Example

Sample Code

This example uses the sourceIndex property to identify the previous and next elements in the all collection.

<SCRIPT>
function fnHandler(){
   // Retrieve the element that fired the event.
   var oElement=event.srcElement;
   var iIndex=oElement.sourceIndex;
   var sTagName=oElement.tagName;
   if(sTagName=="!"){
      sTagName="COMMENT";
   }
   oVal1.innerHTML=iIndex;
   oVal2.innerHTML=sTagName;
   if(iIndex-1>0){
      sTagName=document.all[iIndex-1].tagName;
      if(sTagName=="!"){
         sTagName="COMMENT";
      }   
      oVal3.innerHTML=sTagName;
   }
   else{
      oVal3.innerHTML="Cannot read.";
   }
   if(iIndex+1<document.all.length){
      sTagName=document.all[iIndex+1].tagName;
      if(sTagName=="!"){
         sTagName="COMMENT";
      }   
      oVal4.innerHTML=sTagName;
   }
   else{
      oVal4.innerHTML="Cannot read.";
   }
}
</SCRIPT>

<BODY onmousemove="fnHandler()">
<TABLE>
<TR><TD>Source Index:</TD><TD ID=oVal1></TD></TR>
<TR><TD>Object Name:</TD><TD ID=oVal2></TD></TR>
<TR><TD>Previous Object:</TD><TD ID=oVal3></TD></TR>
<TR><TD>Next Object:</TD><TD ID=oVal4></TD></TR>
</TABLE>
</BODY>
This feature requires Internet Explorer 4 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, custom, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, Hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, KBD, LABEL, LI, LINK, LISTING, MAP, MARQUEE, MENU, META, NEXTID, NOBR, OBJECT, OL, P, PLAINTEXT, PRE, Q, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, XMP



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.