Jump to content

drop down menu css


piotr

Recommended Posts

Hi,

 

I have a drop down menu which takes records from a databse. After a top level link is clicked you are redirected to a category site and the drop down menu reveals subcategory links. But the menu shows it only for a while, when the site is reloaded the menu hides subcategories.

I tried to use onload event but without results.

 

<a href="category,<?=$row_catname[$q]['id']?>.html" 
onClick="switch('<?=$row_catname[$q]['id']?>','block','none' );return true;" class="category">
<?=$row_catname[$q]['title'];?></a>(<?=$nocat;?>)

 

function switch(id,typeA, typeB) { 

   try {
       var currentType = document.getElementById(id).style.display;
       var newType = typeA;
       if(currentType == typeA) {
           newType = typeB;
       } else if (currentType == typeB) {
           newType = typeA;
       }
       document.getElementById(id).style.display=newType;
       return newType; 
   } catch(e) {
       //alert( e.message );
   }
}

 

 

Thanks in advance

Link to comment
Share on other sites

There's no need to change style before exiting current page.

Changes made on current are lost when new page is loaded.

You should set style of menu item in PHP when creating subcategory page.

Resolution with onload of subcategory page should work too.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.