HTML pasted 3 months ago by Anonymous 749 B, 23 Lines, 43 Views
<html>
    <head>
        <style type="text/css">
            ul { display: inline-block; list-style-type: none; }
            ul li { width: 100px; background: blue; }
            ul li.active { background: green; }
        </style>
        <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    </head>
    <body>
        <ul class="menu">
            <li id="page_0"><a href="?pageid=0">First page</a></li>
            <li id="page_1"><a href="?pageid=1">Second page</a></li>
        </ul>

        <script>
          $('ul.menu li a').each (function () {
            if (this.href == document.location)
              $(this).parent ().addClass ('active');
          });
        </script>
    </body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23