The problem is: Originally to achieve the two-level menu scaling, the results can not be scaled ...
The code is as follows:
/*CSS Section*/#navigation > UL{List-style-type:None;margin:0px;padding:0px;}#navigation > Ul > Li{Border-bottom:1px solid #ED9F9F;}#navigation > Ul > li > A{Display:Block;/*Block Display*/padding:5px 5px 5px 0.5em;text-decoration:None;Border-left:12px Solid #711515;/*thick red side on the left*/Border-right:1px solid #711515;/*Right Shadow*/}#navigation > Ul > li > A:link, #navigation > Ul > li > A:visited{Background-color:#c11136;Color:#FFFFFF; }#navigation > Ul > li > A:hover{/*when the mouse passes*/Background-color:#990020;/*change the background color*/Color:#ffff00;/*Change text color*/}/*Level Two menu*/#navigation u li ul{List-style-type:None;margin:0px;padding:0px 0px 0px 0px;}#navigation ul Li ul Li{Border-top:1px solid #ED9F9F;}#navigation ul Li ul li a{Display:Block;padding:3px 3px 3px 0.5em;text-decoration:None;Border-left:28px Solid #a71f1f;Border-right:1px solid #711515;}#navigation ul Li ul Li A:link, #navigation ul Li ul Li a:visited{Background-color:#e85070;Color:#FFFFFF;}#navigation ul Li ul li a:hover{Background-color:#c2425d;Color:#ffff00;}/*Hide sub-menu*/#navigation ul Li Ul.myhide{Display:None;}/*Show sub-menu*/#navigation ul Li Ul.myshow{Display:Block;}
/*HTML Section*/<! DOCTYPE html>{var oU1 = document.getElementById ("Listul"); var aLi = ou1.childnodes; var OA; for (Var i=0;i<ali;i++) {//If the child element is Li, and this Li has a sub-menu ul if (ali[i].tagname = = "Li" && ali[i ].getelementsbytagname ("ul"). Length) {OA = Ali[i].firstchild; Find the hyperlink Oa.onclick = change; Adding a standalone function dynamically}}} function change (){//Through the parent element Li, find the sibling element li var oseconddiv = this.parentNode.getElementsByTagName ("ul") [0]; CSS alternate replacement to achieve display, hide if (oseconddiv.classname = = "Myhide") Oseconddiv.classname = "Myshow"; else Oseconddiv.classname = "Myhide"; } </script>
This is an example I read from the book, when I wrote it, I found it seemed to have problems, and then came to you for help.
Let's take a look at this piece of code. About CSS and HTML.