www.webdeveloper.com
Results 1 to 7 of 7

Thread: [RESOLVED] change META refresh based on form value

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Posts
    53

    resolved [RESOLVED] change META refresh based on form value

    I'm building a feedback system with real-time feedback (kinda like a one-sided chat room) & I need to know how to change the refresh rate of a META refresh based on the number in a form.

    Basically:
    - META refresh starts at 5 seconds
    - If somebody changes the number in the form, the refresh rate changes (ie: from 5 seconds to 10 seconds)

    I'm not sure if this can be done with javascript, or PHP, but I need it.

  2. #2
    Join Date
    Oct 2009
    Posts
    658
    Code:
     window.setTimeout('window.location="location"; ',value);
    Hope that helps

  3. #3
    Join Date
    Aug 2009
    Posts
    53
    Unfortunately it didn't work, maybe because I'm not doing it right.

    Here's the form:
    <input type=text name="rate" id="rate" size="3" value="5">

    And your JavaScript:
    <script type="text/JavaScript">
    window.setTimeout('window.location="location"; ',document.getElementById['rate'].value);
    </script>

    If there's something I'm doing wrong, please tell me.

  4. #4
    Join Date
    Jul 2004
    Location
    India
    Posts
    34
    there is a syntax error

    window.setTimeout('window.location="location"; ',document.getElementById('rate').value);


    and whats expected from "location"?
    johns221b

  5. #5
    Join Date
    Aug 2009
    Posts
    53
    Thanks. works correctly, but it reloads too fast.

    How do I:
    - If form value is 5
    - make it reload every 5 seconds

    do I add a set of zeros on the end?

  6. #6
    Join Date
    Jul 2004
    Location
    India
    Posts
    34
    multiply by 1000
    johns221b

  7. #7
    Join Date
    Oct 2009
    Posts
    658
    the value is in milliseconds so if you want 5 secs value = 5000. Don't forget to mark as resolved.

    Santos Systems

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles