Creating Banner / Image Rotation using JavaScript
Disclaimer
The materials and information in this page (including text, graphics, and functionality) are presented without express or implied warranties of any kind and are provided "as is"; which means, the use of the content on the page is entirely at your risk. It is your responsibility to evaluate the accuracy, completeness and usefulness of any opinions, advice, services or other information provided.
The information, text, graphics and links provided in this Web site / page are provided by EagleSuccess as a convenience to you.
EagleSuccess will use reasonable efforts to include accurate and up-to-date information. However, due to the nature of the Internet, EagleSuccess does not warrant and cannot guarantee the accuracy on the respective owners site.
A courtesy of Bannermakerpro.com, we have displayed below how you can create banner rotation to your website or your clients site.
[FrontPage Save Results Component]
|
<BODY onload="rotatebannersrandom()"> <!– JavaScript Banner Rotator – Rotate banners randomly after a set period of time. <!– Put this text in the BODY section of the HTML – include the onload="rotatebanners() with the BODY tag. –> <script language="JavaScript"> <!– var randnum = (Math.round((Math.random() * 3 ) )); links = new initArray( "http://www.yourdomain.com/", "http://www.yourdomain.com/", "http://www.yourdomain.com/", "http://www.yourdomain.com/" ) images = new initArray( "http://www.yourdomain.com/images/1.gif", "http://www.yourdomain.com/images/2.gif", "http://www.yourdomain.com/images/3.gif", "http://www.yourdomain.com/images/4.gif" ) alttext = new initArray( "Webpage Design", "Webpage Design", "Webpage Design", "Webpage Design" ) function initArray() { this.length = initArray.arguments.length; for (var i = 0; i < this.length; i++) { this[i] = initArray.arguments[i]; } } function rotatebannersrandom() { var currentnum = randnum; while (currentnum == randnum) { randnum = (Math.round((Math.random() * 3 ) )); } document.BannerAd.src=images[randnum] document.BannerAd.alt=alttext[randnum] bannerlink = links[randnum] banlink.href=links[randnum] setTimeout("rotatebannersrandom()",5000) } // –> </script> <script language="JavaScript"> <!– var bannerlink = "http://www.yourdomain.com/" var banlink = "" function changelink() { location = bannerlink } // –> </script> <a href=’javascript:changelink()’ name="banlink"><img src="http://www.yourdomain.com/images/1.gif" name="BannerAd" alt="" ></a> Or <a href=’javascript:changelink()’ name="banlink"><img border="0" src="images/1.gif" width="" height="" name="BannerAd" alt="" title=""></a> <!– End Banner Rotator BODY Code –>
|
