Results 1 to 2 of 2

Thread: Time delay before script runs

  1. #1
    Join Date
    Sep 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Time delay before script runs

    http://www.dynamicdrive.com/dynamici...allery_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

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Rename this function:

    Code:
    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:
    Code:
    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •