Background image slideshow javascript source code

Here is the code for background image slideshow using javascript and css.

check out the code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us">
background-repeat: no-repeat;
background-position: 50 50;
<script >
//Specify background images to slide
var imgs=new Array()
//Specify interval between slide (in miliseconds)
var speed=2000
//preload images
var processed=new Array()
for (i=0;i<imgs.length;i++){
processed[i]=new Image();
var inc=-1;
function slideimg(){
if (inc<imgs.length-1)
if (document.all||document.getElementById)
window.onload=new Function('setInterval("slideimg()",speed)');
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table1" height="381">
			<p>This is just dummy text</p>
			<p>This is just dummy text</p>
			<p>This is just dummy text</p>
			<p>This is just dummy text</p>

You can use it for any elements background.

hope it will be useful.
thanx n regards,
Nikhil Ughade
Web Designer

About Nikhil
Name : Nikhil Ughade UI Developer, Accidentally in design field, no turn back since then. Location : Pune (MH, INDIA) From : Amravati (MH,INDIA) College : VYWS's College Of Engg. Badnera, Amravati Hobby : Social Networking, Designing Web Sites, Photography, Reading Books. In Free time works for NGO.

4 Responses to Background image slideshow javascript source code

  1. vidandroide says:

    It is exactly (almost) what I was looking for, buy … Is it possible to fade in images?

  2. Hi Nikhil,
    I like this script but I have a question. How to put it into a specific DIV ?

    Example: I have a DIV called “header_clearfix” where I would place differnt images as background, rotating every X seconds.

    Can you help me ?

    NOTE: I cannot use Jquery in my site, so I would like to use your script.


  3. Contact me using Twitter @realsandrotoni


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 260 other followers

%d bloggers like this: