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

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
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Web programming � everything from the basics of visual design and architecture to the specifics of applications, graphics, and scripting. More Web Programming: Most Popular Materials | Fresh Materials | More JavaScript Tutorials at LearnPHP.org

Add comments to "Background Slide Show"

Only registered users can write comment

No comments yet...