JS Control navigation Menu tab

Source: Internet
Author: User

Click to the new page, you must use JS in the new page to determine which display, if you are the current position of the tab style name: selected,

If you want the second one to be selected after the new page, you can only

Documengt.getelementbyid ("Navigation"). getElementsByTagName ("Li") [1].classname= "Selected";

That's it, okay?

Navigation This is the label for the navigation div layer's ID Li as the front row, formatted as follows

<div id= "Navigation" >
<ul>
<li> Navigation </li>
<li> Navigation </li>
</ul>
</div>

Or
<ul id= "Navigation" >
<li> Navigation </li>
<li> Navigation </li>
</ul>

<script type= "Text/javascript" >
Documengt.getelementbyid ("Navigation"). getElementsByTagName ("Li") [1].classname= "Selected";
</script>

Method Two

Function Doclick_down (o) {
  o.classname= "Menua";
  var J;
  var id;
  var e;
&n Bsp for (Var i=1;i<=11;i++) {
    id = ' down ' +i;
    j = document.getElementById (ID) ;
    e = document.getElementById ("D_con" +i);
    if (id!= o.id) {
      j.classname= "menu";
      E.style.display = "None";
   }else{
  e.style.display = "block";
   }
 }
& nbsp
Window.onerror = function () {return true};
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.