Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: refreshing help

  1. #1
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    refreshing help

    hey,
    how do i get get a script to target a iframe and refresh it after X amount of seconds.

    i found some code to make page refresh but am adding another iframe and dont want this one to refresh also.

    both targets are external and i havn't use HTML since school (a good 4 years ago) and never learnt JS at all.

    Code:
    <script>
    <!--
    var limit="0:10"
    
    if (document.images){
    var parselimit=limit.split(":")
    parselimit=parselimit[0]*60+parselimit[1]*1
    }
    function beginrefresh(){
    if (!document.images)
    return
    if (parselimit==1)
    window.location.reload()
    else{ 
    parselimit-=1
    curmin=Math.floor(parselimit/60)
    cursec=parselimit%60
    if (curmin!=0)
    curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
    else
    curtime=cursec+" seconds left until page refresh!"
    window.status=curtime
    setTimeout("beginrefresh()",1000)
    }
    }
    
    window.onload=beginrefresh
    //-->
    </script>
    also wondering if i need the following code if i remove the minutes from the var timer
    Code:
    var limit="0:10"
    
    if (document.images){
    var parselimit=limit.split(":")
    parselimit=parselimit[0]*60+parselimit[1]*1
    }
    into just
    Code:
    var limit="10"
    thanks in advance

  • #2
    Regular Coder
    Join Date
    Mar 2005
    Posts
    114
    Thanks
    4
    Thanked 3 Times in 3 Posts
    I don't think that the code that you recieved was meant for what you are looking at doing. Now I'm not going to berate you for using iframes (comeon man... really? iframes?) but I found a solution with a quick Google search (refresh an iframe).

    Simply put this line of javascript somewhere that it will be read and you should be good to go. Replace 'myinnerframe' with the name of your frame. The 1000 is the time in miliseconds until the reloading (currently at 10 seconds).

    Code:
    window.setTimeout("self.frames.myInnerFrame.location.reload(true)", 10000);
    I have not tested this code, let me know if it works.

  • Users who have thanked JoWiGo for this post:

    shade0o (05-01-2008)

  • #3
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    its doesn't seem to be working but thanks anyways.

    and im just writing up a small page to stop the auto logout from being idle.
    so for the 10people who are going to see it it wont matter what it looks like so the frames are no worry.


  •  

    Posting Permissions

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