JavaScript - An open source scripting language, it allows the creation of dynamic web page content.  Home Web Programming JavaScript Background Slide Show

Background Slide Show








Click to start the script.

Put this code into your page:

<html>
<head>

<style>
body{
background-repeat: no-repeat;
background-position: 200 100;
}
</style>

</head>

<script language="JavaScript">
<!--

// =======================================
// set the following variables
// =======================================

// Set speed (milliseconds)
var speed = 1000

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'images/slideshow_1.jpg'
Pic[1] = 'images/slideshow_2.jpg'
Pic[2] = 'images/slideshow_3.jpg'
Pic[3] = 'images/slideshow_4.jpg'
Pic[4] = 'images/slideshow_5.jpg'
Pic[5] = 'images/slideshow_6.jpg'
Pic[6] = 'images/slideshow_7.jpg'
Pic[7] = 'images/slideshow_8.jpg'
Pic[8] = 'images/slideshow_9.jpg'

// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
preLoad[i] = new Image()
preLoad[i].src = Pic[i]
}

function runBGSlideShow(){
if (document.body){
document.body.background = Pic[j];
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runBGSlideShow()', speed)
}
}

//-->
</script>

<body bgcolor=black onload="runBGSlideShow()">

<br><br>
<center><font face=arial,helvetica size=2 color=white>Sample Code 13 - Background Slideshow</font></center>

</body>
</html>



Author's URL: Codelifter
JavaScript - An open source scripting language, it allows the creation of dynamic web page content. More JavaScript Tutorials: Featured Materials | Fresh Materials | More JavaScript Tutorials at LearnPHP.org

No comments yet...
Add comments to "Background Slide Show"

Captcha