godsent Posted March 27, 2009 Share Posted March 27, 2009 my toggle_div function looks like this: <script type="text/javascript"> <!-- function toggle_div(id) { var diq = document.getElementById(id).style; diq.display=(diq.display=="none") ? "" : "none"; } //--> </script> It hides and shows a div then clicked. <a href="javascript:toggle_div('content')">Hide/show</a> But then you start website, it starts with shown div, how to make that the div would be hiden then website starts. I think this should work but it doesnt: <script type="text/javascript"> <!-- function toggle_div(id) { var diq = document.getElementById(id).style; diq.display=(diq.display=="none") ? "" : "none"; } toggle_div('content'); //--> </script> Please help me if you know how Link to comment https://forums.phpfreaks.com/topic/151375-toggle_div-little-question/ Share on other sites More sharing options...
lonewolf217 Posted March 27, 2009 Share Posted March 27, 2009 <div style="display:none;"> Link to comment https://forums.phpfreaks.com/topic/151375-toggle_div-little-question/#findComment-795138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.