Jump to content

toggle_div little question


godsent

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.