»
EnglishFrenchVietnamese

Print - Background Image Swapper - JavaScriptBank.com

Full version: jsB@nk » Background » Background Image Swapper
URL: https://www.javascriptbank.com/background-image-swapper.html

Background Image Swapper © JavaScriptBank.comThis JavaScript automatically rotates through a set of background-images similar to a slideshow. Add as many background-images as you like. Great trick to animate your background. Easy configuration of swapping-speed and background-image.

Full version: jsB@nk » Background » Background Image Swapper
URL: https://www.javascriptbank.com/background-image-swapper.html



JavaScript
<SCRIPT language=JavaScript>// Background Image Swapper/*     This script downloaded from www.JavaScriptBank.com     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*/// Author: Peter Gehrig // Web Site: http://www.24fun.com // Put the background-images into the same folder as your webpage.// Add the filnames of your background-images to the Array bellow (just replace // our background-images with your background-images) var backgroundimage=new Array("../image/logojs.gif","../image/logocuoi.gif","../image/logojs.gif","../image/logocuoi.gif")// swapping speed (seconds)var swapspeed=2// do not edit the code belowvar timervar imgpreload=new Array()if (document.all) {    for (i=0;i<=backgroundimage.length-1;i++) {    imgpreload[i]=new Image()    imgpreload[i].src=backgroundimage[i]    }}var i_backgroundimage=0swapspeed=swapspeed*1000function swapimages() {if (document.all) {        window.status=i_backgroundimagedocument.body.background=backgroundimage[i_backgroundimage]        i_backgroundimage++        if (i_backgroundimage>=backgroundimage.length) {i_backgroundimage=0}timer=setTimeout("swapimages()",swapspeed)}}window.onload=swapimages</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->