jquery - How can i keep the selected li menu after postback -


i dont speak english have listed controls on aspx form below

here´s menu:

<div id='cssmenu'>             <ul>                <li class='active'><a href=''><span>inicio</span></a></li>                <li class='has-sub'><a href='#'><span>portafolio</span></a>                   <ul>                      <li><asp:linkbutton id="linkresum" runat="server" onclick="link_selectedindexchanged"                       text="&nbsp;&nbsp;&nbsp;&nbsp;■ resumen" onclientclick="cargar()"></asp:linkbutton></li>                   </ul>                </li>                <li><asp:linkbutton id="linkreport" runat="server" onclick="link_selectedindexchangedreport"                       text="reporte" onclientclick="cargar2()"></asp:linkbutton></li>                <li class=''><a href='#'><span>formularios</span></a></li>                <li><asp:linkbutton id="linkbutton1" runat="server" onclick="link_selectedindexchangedcontacto"                       text="contacto" onclientclick="cargar3()"></asp:linkbutton></li>                <li class=''><a href="javascript:__dopostback('dnn$dnnlogin$cmdlogin','')"><span>cerrar sesion</span></a></li>             </ul>          </div> 

and jquery this

here´s script:

<script type="text/javascript">  $(document).ready(function() {     $('#cssmenu ul ul li:odd').addclass('odd');     $('#cssmenu ul ul li:even').addclass('even');     $('#cssmenu > ul > li > a').click(function() {         $('#cssmenu li').removeclass('active');         $(this).closest('li').addclass('active');         var checkelement = $(this).next();         if ((checkelement.is('ul')) && (checkelement.is(':visible'))) {             $(this).closest('li').removeclass('active');             checkelement.slideup('normal');         }         if ((checkelement.is('ul')) && (!checkelement.is(':visible'))) {             $('#cssmenu ul ul:visible').slideup('normal');             checkelement.slidedown('normal');         }         if ($(this).closest('li').find('ul').children().length == 0) {             return true;         } else {             return false;         }     }); }); 

i want keep selected li after postback, im not jquery programmer...

thank you.

save files index.html click menu item use alert function debug

<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml">       <head>         <title>accordion test</title>         <script type="text/javascript" src="http://ajax.googleapis.centercodehereom/ajax/libs/jquery/1.6.2/jquery.min.js"></script>         <script type="text/javascript">             $(document).ready(function () {                  // initialize accordion                 $('#accordion ul').each(function () {                     alert(currenturi);                     var currenturi = window.location.href;                     var links = $('a', this);                     var collapse = true;                     alert(links.size());                     (var = 0; < links.size() ; i++) {                         var elem = links.eq(i);                         var href = elem.attr('href');                         var hreflength = href.length;                         var compareto = currenturi.substr(-1 * hreflength);                           if (href == compareto) {                             alert(href);                             collapse = false;                             break;                         }                     };                     if (collapse) {                         $(this).hide();                     }                 });                  // on click, show element , hide others                 $('#accordion > li').click(function () {                     var me = $(this).children('ul');                     $('#accordion ul').not(me).slideup();                     me.slidedown();                 });             });         </script> </html> <body>     <ul id="accordion">         <li>             people             <ul>                 <li><strong>+</strong> <a href="index.html?show=yousuf&ali">yousuf ali</a></li>                 <li><strong>+</strong> <a href="index.html?show=hanifa">hanifa</a></li>                             <li><strong>+</strong> <a href="index.html?show=mohamed">mohamed</a></li>              </ul>         </li>         <li>             events             <ul>                 <li><strong>+</strong> <a  href="index.html?show=khaja&mohideen">coming soon</a></li>             </ul>         </li>         <li>             landscapes             <ul>                 <li><strong>+</strong> <a  href="index.html?show=askar&ali">coming soon</a></li>             </ul>         </li>         <li>             info             <ul>                 <li><strong>+</strong> <a  href="index.html?show=mohideen&ali">coming soon</a></li>             </ul>         </li>     </ul> </body> </html> 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -