Rotate a Banner

[Total: 0    Average: 0/5]

This shows how to rotate 2 separate images that each have their own links on a 5 second timer.

Head Code:

<!--
  -- Note: You must download the div_construct.js and image files to your
  --       own server, or this code will not work correctly.
  -->
<script type=text/javascript src="http://www.js-examples.com/bin/div_construct.js"></script>
<script type=text/javascript>
var _m1 = "";
_m1 += "<a href='http://www.js-examples.com/'>";
_m1 += "<img border=0 alt='image 1' src='http://www.js-examples.com/images/blue_ball0.gif'>"
_m1 += "</a>";
var _m2 = "";
_m2 += "<a href='http://www.js-examples.com/page/javascripts.html'>";
_m2 += "<img border=0 alt='image 2' src='http://www.js-examples.com/images/red_ball0.gif'>"
_m2 += "</a>";
var div1 = new NewDiv(window, "banner", _m1,0,0,50,50,-1,"ABSOLUTE");

var count=1;
function doIt() {
if (count != 1) {count=1;} else {count=2;}
div1.setBody(eval("_m"+count));
}
setInterval('doIt()',5000);
</script>

Body Code:

<script type=text/javascript>
div1.output();
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *