How to set the selected menu highlighted after page refresh

AsbMay

New Member
I have got a task to do horizontal menu.Here I have a problem with the selection of menu.This is my code.But after page refresh the selected menu will disappear.How can i solve this?\[code\]<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script><style> .menu{width: 300px; height: 25; font-size: 18px;} .menu li{list-style: none; float: left; margin-right: 4px; padding: 5px;} .menu li:hover, .menu li.active { background-color: #f90; }</style><ul class="menu"><li>Item 1</li><li class="active">Item 2</li><li>Item 3</li><li>Item 4</li><li>Item 5</li><li>Item 6</li></ul><script type="text/javascript">var make_button_active = function(){ var siblings =($(this).siblings()); siblings.each(function (index) { $(this).removeClass('active'); } ) $(this).addClass('active');}$(document).ready( function() { $(".menu li").click(make_button_active); } )</script>\[/code\]
 
Back
Top