The main process of writing a Java Script, the effect is good, but in. Net cannot run!
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> navigation menu </title>
<Style type = "text/CSS">
. Titlestyle {
Background-color: #006600; color: # ffffff; border-top: 1px solid # ffffff; font-size: 9pt; cursor: hand;
}
. Contentstyle {
Background-color: # eeffee; color: Blue; font-size: 9pt;
}
A {
Color: blue;
}
Body {
Font-size: 9pt;
}
</Style>
</Head>
<Body>
<Script language = "JavaScript">
<! --
VaR layertop = 20; // top menu margin
VaR layerleft = 30; // left margin of the menu
VaR layerwidth = 140; // The total menu width
VaR titleheight = 20; // Title Bar Height
VaR contentheight = 200; // content area height
VaR stepno = 10; // The number of moving steps. The larger the value, the slower the movement.
VaR itemno = 0; runtimes = 0;
Document. write ('<span id = itemslayer style = "position: absolute; overflow: hidden; Border: 1px solid #008800; left:' + layerleft + '; top: '+ layertop +'; width: '+ layerwidth +'; "> ');
Function additem (itemtitle, itemcontent ){
Itemhtml = '<Div id = item' + itemno + 'itemindex =' + itemno + 'style = "position: relative; left: 0; top: '+ (-contentheight * itemno) +'; width: '+ layerwidth +'; "> <Table width = 100% cellspacing =" 0 "cellpadding =" 0 "> '+
'<Tr> <TD Height =' + titleheight + 'onclick = changeitem ('+ itemno + ') class = "titlestyle" align = center> '+ itemtitle +' </TD> </tr> '+
'<Tr> <TD Height =' + contentheight + 'class = "contentstyle">' + itemcontent + '</TD> </tr> </table> </div> ';
Document. Write (itemhtml );
Itemno ++;
}
// Add the menu title and content, which can be any number of items. Note the format:
Additem ('Welcome ',' <br> ');
Additem ('webpage taobao ', '<center> <a href = "#"> webpage tools </a> <br> <a href = "#"> technical platform </a> <br> <br> <a href = "#"> Design Philosophy </a> <br> <a href = "#"> more </a> </ center> ');
Additem ('art classroom ', '<center> <a href = "#"> graphic design </a> <br> <a href = "#"> 3D space </a> <br> <br> <a href = "#"> Design Basics </a> <br> <a href = "#"> more .. </a> </center> ');
Additem ('flash ', '<center> <a href = "#"> basic tutorial </a> <br> <a href = "#"> skills </a> <br> <br> <a href = "#"> instance profiling </a> <br> <a href = "#"> more .. </a> </center> ');
Additem ('multimedia ', '<center> <a href = "#"> Director </a> <br> <a href = "#"> Authorware </a> <br> <BR> <a href = "#"> more .. </a> </center> ');
Additem ('excellent appreciation ',' <center> <a href = "#"> design excellent products </a> </center> ');
Document. Write ('</span> ')
Document. All. itemslayer. style. Height = itemno * titleheight + contentheight;
Toitemindex = itemNo-1; onitemindex = itemNo-1;
Function changeitem (clickitemindex ){
Toitemindex = clickitemindex;
If (toitemindex-onitemindex> 0) moveup (); else movedown ();
Runtimes ++;
If (runtimes> = stepno ){
Onitemindex = toitemindex;
Runtimes = 0 ;}
Else
SetTimeout ("changeitem (toitemindex)", 10 );
}
Function moveup (){
For (I = onitemindex + 1; I <= toitemindex; I ++)
Eval ('document. all. item '+ I + '. style. top = parseint (document. all. item '+ I + '. style. top)-contentheight/stepno ;');
}
Function movedown (){
For (I = onitemindex; I> toitemindex; I --)
Eval ('document. all. item '+ I + '. style. top = parseint (document. all. item '+ I + '. style. top) + contentheight/stepno ;');
}
Changeitem (0 );
// -->
</SCRIPT>
</Body>