gazfocus Posted March 12, 2010 Share Posted March 12, 2010 I am trying to make a Javascript expand menu which works locally but not once I upload it to the server. Can anyone help? The html is: <a alt="Digital Print Options - Click to expand" href="javascript:void(0);" onclick="expandit('expand1');">Digital Print Options</a><div id="expand1" style="display:none"> <a alt="Childrens Options" href="Digital-Print-Childrens.php">Children's Options</a> <br /> <a alt="Adult Options" href="Digital-Print-Adult.php">Adult Options</a><br /></div> The Javascript is: // Navigation Expander function expandit(curobj, hide) { if(document.getElementById(curobj)) { folder=document.getElementById(curobj).style; } else { if(ns6==1||operaaa==true) { folder=curobj.nextSibling.nextSibling.style; } else { folder=document.all[curobj.sourceIndex+1].style; } } if(folder.display=="none") { folder.display=""; } else { folder.display="none"; } if(hide) { var hide_objects = hide.split(","); for(i=0; i<hide_objects.length; i++) { hide_objects[i]=hide_objects[i].replace(/^\s*(.*)/, "$1"); hide_objects[i]=hide_objects[i].replace(/(.*?)\s*$/, "$1"); if(document.getElementById(hide_objects[i])) { hidden=document.getElementById(hide_objects[i]).style; if(hidden.display=="") { hidden.display="none"; } } } } } Quote Link to comment Share on other sites More sharing options...
Adam Posted March 12, 2010 Share Posted March 12, 2010 What error do you get? Quote Link to comment Share on other sites More sharing options...
gazfocus Posted March 12, 2010 Author Share Posted March 12, 2010 What error do you get? When I click on the parent item, it just does nothing. Quote Link to comment Share on other sites More sharing options...
DaiLaughing Posted March 13, 2010 Share Posted March 13, 2010 Works for me with IE8 and Firefox 3.6. I'd suggest using a CSS-only menu though as that is going to work acorss more users' systems. Quote Link to comment Share on other sites More sharing options...
gazfocus Posted March 13, 2010 Author Share Posted March 13, 2010 Works for me with IE8 and Firefox 3.6. I'd suggest using a CSS-only menu though as that is going to work acorss more users' systems. As I said, it works locally but when I upload the pages to the server, it ceases to work. Can anyone point me in the right direction for a css version then? Ta Quote Link to comment Share on other sites More sharing options...
DaiLaughing Posted March 13, 2010 Share Posted March 13, 2010 I guess I wasn't clear enough. It works for me. Try this in the near future and you will presumably see what i get: http://www.yourwebskills.com/fred.html That is a scratchpad page so next time I need to try something it will not show your page. Quote Link to comment Share on other sites More sharing options...
Adam Posted March 14, 2010 Share Posted March 14, 2010 What error do you get? When I click on the parent item, it just does nothing. I said what error do you get? In FF you can find JS errors in the error console (tools > error console). Most of the popular browsers I believe have some form of console for you to check errors. Quote Link to comment Share on other sites More sharing options...
DaiLaughing Posted March 14, 2010 Share Posted March 14, 2010 Given that it works for me when uploaded to my server (in Chrome as well as FF and IE) and with no errors I would suggest the problem is not the code. 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.