0

Hello i need help with javascript on how to show and hide ads as i ont know much about javascript

<html>
<h2>Hide Div in JavaScript</h2>
<script language=javascript type='text/javascript'> 
function hideDiv() { 
if (document.getElementById) { 
document.getElementById('div').style.visibility = 'hidden'; 
} 
} 
function showDiv() { 
if (document.getElementById) { 
document.getElementById('div').style.visibility = 'visible'; 
} 
} 
</script> 
<body onload="javascript:showDiv()">
<button onclick="javascript:hideDiv()">Hide</button> 
<button onclick="javascript:showDiv()">Show</button>


<div id="div">

<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxx";
google_ad_slot = "xxxxxxx";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlexxxxxxx.com/pagead/xxxxxx.js">
</script>

</div>
</body>
</html>

Above code works if i put hellow world between div but it doeesnt if i put ad code. ads never get hide

2
Contributors
1
Reply
16
Views
4 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.