I created a JavaScript function that is what essentially is a "banner" that cycles through two images. The problem I'm having is that its placing this "banner" in my static website banner/logo at the top of my page.
I would like to put this script/function in a div so that I can place it where I would like, on my page. I have tried various things but I can't figure it out.
heres what my code looks like: ...
<body onload = "var begin = setInterval('special_ad()', 2000);">
...
...
<div id="special_banner">
<script type="text/javascript">
/*<![CDATA[*/
var curImage = "banner1";
function special_ad(){
if (curImage == "banner2"){
document.images[0].src = "images/banner1.png";
curImage = "banner1";
}
else{
document.images[0].src = "images/banner2.png";
curImage = "banner2";
}
}
/*]]*/
</script>
<p></p>
</div>
...
</body>
"..." being other code i didn't think necessary to post. Now currently i have the script located in the div "special_ad" and the onload syntax in the body tag but it just places the image at the top of my page.
What do I need to do to call the function in the div I want, so that I can control where the image/banner are located on my page?