PDA

View Full Version : Converting window.onload to bodytag


dhtmlhelp
08-09-2002, 12:47 AM
Hi,

how do I convert window.onload=new Function("setTimeout('movecube()',delay)") to an onLoad bodytag?

thanks,

DHTMLHELP

adios
08-09-2002, 01:05 AM
<body....onload="setTimeout('movecube()',delay)">

Make sure delay is globally defined.

mordred
08-09-2002, 10:08 AM
Just make sure that "delay" is defined in the global namespace, i.e. is not defined within function definitions with the "var" keyword prepended.

var delay = 200;

function movecube() {...}

dhtmlhelp
08-09-2002, 08:00 PM
Hi,

I think it is. Here is the code:

<script language="JavaScript1.1">
//Picture Cube slideshow - By Tony Foster III
//Modifications by JK
//Visit JavaScript Kit (http://javascriptkit.com) for script
var specifyimage=new Array() //Your images
specifyimage[0]="sg/os/img/vcontent.gif"
specifyimage[1]="sg/mil/img/vcontent.gif"
specifyimage[2]="sg/sml/img/vcontent.gif"

var linkforimage=new Array()//Links to match your images
linkforimage[0]="sg/os/os.html"
linkforimage[1]="sg/mil/mil.html"
linkforimage[2]="sg/sml/sml.html"

var clickdest = linkforimage[0]

var delay=8000 //8 seconds

//Counter for array
var count =1;

var cubeimage=new Array()
for (i=0;i<specifyimage.length;i++){
cubeimage[i]=new Image()
cubeimage[i].src=specifyimage[i]
}

function movecube(){
if (window.createPopup)
cube.filters[0].apply()
document.images.cube.src=cubeimage[count].src;
clickdest = linkforimage[count]
if (window.createPopup)
cube.filters[0].play()
count++;
if (count==cubeimage.length)
count=0;
setTimeout("movecube()",delay)
}

window.onload=new Function("setTimeout('movecube()',delay)")
</script>


how do I get around this?

thanks,

DHTMLHELP

adios
08-09-2002, 11:22 PM
How do you get around what? :confused: