Results 1 to 4 of 4

Thread: [RESOLVED] Problem using a timer to change div styles

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Resolved [RESOLVED] Problem using a timer to change div styles

    I've created a page to show a 'please wait' box then using a timer to hide the 'please wait' box and show other div elements.

    Code:
    function StartTheTimer(){
        if (secs==0)
        {
            StopTheClock()
            // when finished show quote and continue
    		document.getElementById("form-pagebreak-back_14").style="display:block;"
    		document.getElementById("form-pagebreak-next_14").style="display:block;"
    
    		document.getElementById("id_15").style="display:block;"
    		document.getElementById("id_168").style="display:block;"
    		document.getElementById("id_178").style="display:block;"
    		document.getElementById("id_18").style="display:block;"
    		document.getElementById("id_4").style="display:block;"
    		document.getElementById("cid_4").style="display:block;"
        }
        else
        {
            self.status = secs
            secs = secs - 1
            timerRunning = true
            timerID = self.setTimeout("StartTheTimer()", delay)
        }
    I use the Free Javascript Editor and when i run the code it stops at this line and says 'not implemented'.
    Code:
    document.getElementById("form-pagebreak-back_14").style="display:block;"
    Thanks in advance, Chris1990.
    If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.

    If you fail, try and try again, its the only way to success.

  2. #2
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: Problem using a timer to change div styles

    Try this,

    HTML Code:
    document.getElementById("form-pagebreak-back_14").style.property="display:block;"

  3. #3
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Problem using a timer to change div styles

    When setting styles via DOM you want to use element.style.property = "foo", not element.style = "property:foo". It's slightly different to how you define it in a CSS file.

    JavaScript Code:
    1. document.getElementById("form-pagebreak-back_14").style.display = "block";

    https://developer.mozilla.org/en/DOM...ng_information
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Re: Problem using a timer to change div styles

    thanks for your help its working now.
    If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.

    If you fail, try and try again, its the only way to success.

Posting Permissions

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



Click Here to Expand Forum to Full Width