Auto refreshing of 2 separate iframes on web page

Discussion in 'JavaScript' started by futura65, Feb 12, 2010.

  1. #1
    Hi there,
    I've had a web page that had a single iframe that I used a piece of java code to automatically refresh just the iframe, not the entire page. I want to add a second iframe to the same page and refresh them both....but I'm having some troubles. No matter what I do, I only get one of the two to refresh...not both. I have them listed with separate id=xxxxxx but I feel I'm going wrong somewhere in the script.

    The snips of line read like this

    <td >
    <iframe id=first_iframe style="border:1px solid;" width="599" height="335" frameborder="0" scrolling="no" src="http://www.1111111"></iframe>
    </td>
    <td >
    <iframe id=second_iframe style="border:1px solid;" width="599" height="335" frameborder="0" scrolling="no" src="http://www.2222222"></iframe>
    </td>
    <script type="text/javascript">
    var ad=document.getElementById('first_iframe','second_iframe');
    function refreshiframe()
    {
    ad.src = 'http://www.1111111','http://www.2222222'

    setTimeout("refreshiframe()", 45000);
    }
    refreshiframe();
    </script>



    thanks in advance for any help
     
    futura65, Feb 12, 2010 IP
  2. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't see why you don't just have two functions running.
     
    krsix, Feb 12, 2010 IP
  3. futura65

    futura65 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, that was my initial thought, I copied the script for the refresh and had it directing to the 2nd iframe, however that still didn't seem to work. Perhaps I didn't separate the two scripts properly, or something, but only one would still refresh. I'm sure it's something terribly simple like a missing ; or , or something pretty basic I'm just not getting. I don't completely understand java code, and work these things out as I go. Could you copy it out as you would see to do it, I'll give it a try and let you know if it work?
     
    futura65, Feb 14, 2010 IP