PDA

View Full Version : Time delay before script runs



hecon
09-10-2005, 07:36 PM
http://www.dynamicdrive.com/dynamicindex17/agallery_dev.htm

First of all this is a great script works very well. :)

I would like to be able to put a time delay in before the scripts runs

it just runs from window.onload, can I tell it to run say after 30 secounds.

How do i do this if possible.. PS newby at javascript but work on it
.

Do you have any good base java site which I could teach my self a bit more.

thanks ken

jscheuer1
09-10-2005, 09:41 PM
Rename this function:


function startgallery(){
if (document.getElementById("controldiv")) //if it exists
document.getElementById("controldiv").style.display="block"
getElementbyClass("gallerycontent")
totalDivs=partscollect.length
if (document.gallerycontrol){
populatemenu()
if (document.gallerycontrol.mode){
for (i=0; i<document.gallerycontrol.mode.length; i++){
if (document.gallerycontrol.mode[i].checked)
displaymode=document.gallerycontrol.mode[i].value
}
}
}
if (displaymode=="auto" && document.gallerycontrol)
document.gallerycontrol.menu.disabled=true
expandone()
}to:

startgallery1(){

Then, make a new startgallery function:

function startgallery(){
setTimeout("startgallery1()", 30000)
}Put it just below the original one in the code. 30000 is the number of milliseconds before the main function runs, 1000 = 1 second, adjust as desired.