View Full Version : dynamic table background image

03-14-2004, 06:35 PM
I have used this script below but all I get is a white screen. the paths to the images are correct.

Can anyone help me please?

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


<SCRIPT LANGUAGE="Javascript"><!--

var arr = newArray("graphics/main_img1.jpg","graphics/main_img2.jpg","graphics/main_img3.jpg");

var increment = Math.floor(Math.random() * arr.length);

//pre-load image
var img = new Image();

document.getElementById('tblID').style.background="white url("+img.src+") no-repeat fixed center"

<table id="tblID">
<td width="500" height="500"></td>


03-14-2004, 06:37 PM
I usually put a \ before a / in javascripts I believe

Willy Duitt
03-14-2004, 07:27 PM
newArray is two words.

This: arr = newArray
Should be: arr = new Array


03-14-2004, 09:03 PM
thanks for the replys, it works now but my dhtml menu is not working. might be something to do with having 2 onloads now.

Thanks anway

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum