# Hiding a div

**URL:** <https://forum.kirupa.com/t/hiding-a-div/159162>\
**Category:** Uncategorized\
**Created:** [August 15, 2005, 2:30pm UTC](https://forum.kirupa.com/t/hiding-a-div/159162 "2005-08-15T14:30:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RabBell](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rabbell/32/340_2.png) [@RabBell](https://forum.kirupa.com/u/RabBell)\
**Post date:** [August 15, 2005, 2:30pm UTC](https://forum.kirupa.com/t/hiding-a-div/159162/1 "2005-08-15T14:30:28Z")

</div>

ok I’m eventually gonna use this code for one of those fancy flash pop adverts we see so much of nowadays, the ones we’ve all grown to love :love:

don’t worry though this one will only pester people at my office (intranet)

Anyway heres the code

```auto
<script language="javascript">
<!--
function MM_HideTheAd(){
var theadvert;

	theadvert = document.getElementByID("thead");
	theadvert.style.display = "none";
	theadvert.style.visibility = "hidden";
}

function MM_ShowTheAd(){
var theadvert;

	theadvert = document.getElementByID("thead");
	theadvert.style.display = "block";
	theadvert.style.visibility = "visible";
}
//-->
</script>
</head>

<body onload="MM_HideTheAd">
<div id="thead" style="display:none;">
HELP YOU CAN SEE ME!!!
</div>
<br />
<a href="JavaScript:MMShowTheAd()">switch</a>
</body>
</html>

```

it doesn’t seem to be paying attention to the javascript code because if I remove the style=“display:none;” from the div tag then I can see the div, even though the js function is supposedly turning it off

any helps appreciated ☹
