piotr Posted June 28, 2009 Share Posted June 28, 2009 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 Quote Link to comment Share on other sites More sharing options...
dzelenika Posted June 28, 2009 Share Posted June 28, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.