<Html> <Head> <Title> DIV layer switching </title> <Script language = "JavaScript" type = "text/javascript"> /*************************************** ****** Function: Universal DIV switching function Parameter: divID -- ID of the current DIV; divName -- Name prefix of the DIV group to be changed; zDivCount -- number of DIV groups-1 BY: JetKing 2007.06. **************************************** *****/ Function ChangeDiv (divId, divName, zDivCount) { For (I = 0; I <= zDivCount; I ++) { Document. getElementById (divName + I). style. display = "none "; } Document. getElementById (divName + divId). style. display = "block "; } </Script> </Head> <Body> Layer switching example: <br> By: JetKing (www.80Boby. Com) <br> <Span onMouseMove = "JavaScript: ChangeDiv ('0', 'jkdiv _ ', 2 )" Style = "cursor: hand;"> content 1 </span> <Span onMouseMove = "JavaScript: ChangeDiv ('1', 'jkdiv _ ', 2 )" Style = "cursor: hand;"> content 2 </span> <Span onMouseMove = "JavaScript: ChangeDiv ('2', 'jkdiv _ ', 2 )" Style = "cursor: hand;"> content 3 </span> <Div id = "BigDIV" Style = "border: solid 1px # cccccc; width: 460px; margin: 10px;"> <Div id = "JKDiv_0" style = "font-size: 14px; margin: 20px; color: # FF0000;"> Content Section 1 <br> </div> <Div id = "JKDiv_1" Style = "display: none; font-size: 14px; margin: 10px; color: # FF0000;"> Content section 2 <br> </div> <Div id = "JKDiv_2" Style = "display: none; font-size: 14px; margin: 10px; color: # FF0000;"> Content section 3 </div> </Div> </Body> </Html> |