www.webdeveloper.com
Results 1 to 13 of 13

Thread: Javascript Option Box, Auto Refresh iFrame

  1. #1
    Join Date
    Dec 2005
    Posts
    4

    Question Javascript Option Box, Auto Refresh iFrame

    Hey Guy's & Girl's,

    Need Your Help With This One, This Is My First Post Yay!

    I Currently Have A Webpage With Links To Scanners & Pager Messages & So On.

    Page: Scanner Page

    What I Am Trying To Do Is Include An Option Box That Has A Refresh Time On The Parent Window. The User Selects The Refresh Time From A Drop Down Option Box & The iFrame Window Refreshes Every X Seconds Based On What The User Has Selected. Note I Can Only Modify The Parent Window, The Data In The iFrame Is Polled On Another Server. Every Time A New Pager Message Is Received.

    Any Help Would Be Great Guys.

  2. #2
    Join Date
    Sep 2005
    Location
    in my house
    Posts
    234
    call this function once the page loads
    Code:
    function reloadIt()
    {
    frm=document.getElementsByName("pagers")[0];//we get the iframe object
    frm.src=frm.src;//or you can set the src to a new src.
    setTimeout("reloadIt()",60000);//the function will run every 60000 miliseconds, or 60 seconds
    }

  3. #3
    Join Date
    Dec 2005
    Posts
    4

    Question

    Thank You For Your Help, Sorry Still New To JavaScript, Do I Need To Put Any Tags Or Strings Or Do I Just Insert That Code Into The Webpage?
    Last edited by CyberCitizen; 12-07-2005 at 07:23 PM.

  4. #4
    Join Date
    Sep 2005
    Location
    in my house
    Posts
    234
    ok sorry, it should be included in <script></script> tags, like this
    HTML Code:
    <script languaje="javascript">
    function reloadIt()
    {
    frm=document.getElementsByName("pagers")[0];//we get the iframe object
    frm.src=frm.src;//or you can set the src to a new src.
    setTimeout("reloadIt()",60000);//the function will run every 60000 miliseconds, or 60 seconds
    }
    </script>
    and then you call the function "reloadIt()" in the body tag like this:
    HTML Code:
    <body onload="reloadIt()">

  5. #5
    Join Date
    Dec 2005
    Posts
    4

    Thumbs down

    Didn't Work,

    Can You Please Check My Script, I Have Re-Uploaded The Webpage.

    I Sat There Watching It For 4 Minutes. I Set The Timer For 2 Minutes To Auto Refresh the iFrame, However It Had Not Refreshed After 4 Minutes. Right Clicked In iFrame & Pressed Refresh & The Page Had Been Updated.

    It Would Appear That The Script Is Still Not Refreshing The iFrame.

  6. #6
    Join Date
    Sep 2005
    Location
    in my house
    Posts
    234
    hehe, it is because you put it all in one line, it would normally work, but since there are comments this is what is happening
    Code:
    function showAlerts()
    {
    alert("alert one")
    //alert("alert two")
    }
    in that case, the only thing working is alert one, alert two and that entire row are being commented out, so you will only get one alert
    try to separate them into multiple lines OR remove the coments ive put on it
    lemme know if it worked

  7. #7
    Join Date
    Sep 2005
    Location
    in my house
    Posts
    234
    sorry, everything from the //is being ignored, not before it

    Code:
    this runs//this does not run
    another way to make comments is this

    Code:
    alert("1"); /*bla bla bla*/ alert("2");
    both alerts should work

  8. #8
    Join Date
    Dec 2005
    Posts
    4
    Great Thank You So Much For Your Help I Have Asked A Couple Of Places & No One Has Been Able to Help. I Now Have It Working Very Well At A 2 Minute Refresh.

    Also On The Other Issue When It Was All One Line, That Was Weird. Its Spaced Out Nice In The Forums With The Enters In The Right Place, However When I Copied It To Notepad It Put It On One Line & I Did Not Notice.

    Once Again Thanks For Your Help.

  9. #9
    Join Date
    Jul 2006
    Posts
    3

    auto refresh problem

    i was passing thru your discussions on auto refresh problem. i need a
    help on html auto refresh feature. my main page has a auto refresh with java
    scripts. When i invoke a different html window from my main window when autorefresh is happening the second window looses focus and goes behind my main page. how to over come this problem. I would like my main page to keep refreshing at the background with out disturbing other pages.
    thanks & regards
    Selva

  10. #10
    Join Date
    Nov 2007
    Posts
    1

    Also a repost?

    I would like something like this to work, if possible, reposting the information on a form.

    For instance, say the iframe I'm using has a form. Can it automaticly resubmit the information over a standard time period?

    Quote Originally Posted by saulss
    ok sorry, it should be included in <script></script> tags, like this
    HTML Code:
    <script languaje="javascript">
    function reloadIt()
    {
    frm=document.getElementsByName("pagers")[0];//we get the iframe object
    frm.src=frm.src;//or you can set the src to a new src.
    setTimeout("reloadIt()",60000);//the function will run every 60000 miliseconds, or 60 seconds
    }
    </script>
    and then you call the function "reloadIt()" in the body tag like this:
    HTML Code:
    <body onload="reloadIt()">

  11. #11
    Join Date
    Jun 2011
    Posts
    1

    Auto Refresh Assistance

    Here's my initial Iframe code. I'm looking to auto refresh this frame every 5 seconds.

    <iframe src="http://www.autoeurope.com/noapp/hcam.cfm" width="342" height="260">;Your browser does not support iframes.</iframe>

    Can anyone assist?

    Thanks.

  12. #12
    Join Date
    Aug 2008
    Location
    UA, Sevastopol
    Posts
    2
    Write in body of frame:

    <META HTTP-EQUIV="refresh" CONTENT="5">
    CONTENT="5" <=== time in seconds for refresh.

    JavaScript for frame refresh - not good idea.

  13. #13
    Join Date
    May 2012
    Posts
    1
    i am trying this in html

    this is the code i got for my iframe and it does not refresh i tried adding the code that legat said below

    <iframe id="chat" src="http://murl.comp" style="width: 210px; height: 63px" scrolling="no" name="chat" border="0" frameborder="0" META HTTP-EQUIV="refresh" CONTENT="5"></iframe>

    any ideas

Thread Information

Users Browsing this Thread

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

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