Web Analytics Made Easy -
StatCounter Update iframe? - CodingForum

Announcement

Collapse
No announcement yet.

Update iframe?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Update iframe?

    IFRAME SRC="" width=772 height=630 name="worldframe" frameborder="0" scrolling="no">
    </IFRAME>


    How would I go about updating the iframe once an option has been selected from a drop down list?

    For instance when the user selects an option from a drop down list, the iframe updates to show the a page. However, if the user clicks a different option the iframe updates with to show a different page?

    Any help is greatly appreciate, thanks.

  • #2
    You'd need to use JavaScript; something like this:

    <select id="sel" onchange="update(this.value)">
    <option value="1.html">1</option>
    <option value="2.html">2</option>
    <option value="3.html">3</option>
    </select>

    function update(page) {
    document.getElementById('iframeid').location.href=page;
    }
    markaylward.co.uk

    Comment


    • #3
      I tried this but it didn't work?

      Code:
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Untitled Document</title>
      
      <script type="text/javascript">
      function update(page) {
      document.getElementById('worldurl').location.href=page;
      }
      </script>
      </head>
      
      <body>
      
      <select id="sel" onchange="update(this.value)">
      <option value="http://ams2.runescape.com/lang/en/aff/runescape/game.ws?lowmem=1&plugin=0">1</option>
      <option value="http://mi6.runescape.com/lang/en/aff/runescape/game.ws?lowmem=1&plugin=0">2</option>
      <option value="http://ul5.runescape.com/lang/en/aff/runescape/game.ws?lowmem=1&plugin=0">3</option>
      </select>
      
      <center>
      <IFRAME 
          SRC=""
          NAME="worldurl"
          WIDTH=300 HEIGHT=200>
      </IFRAME>
      </center>
      
      </body>
      </html>

      Comment


      • #4
        Try this sorry, wrote the above in a bit of a rush!

        Code:
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Untitled Document</title>
        
        <script type="text/javascript">
        function update(page) {
        document.getElementById('worldurl').src=page;
        }
        </script>
        </head>
        
        <body>
        
        <select id="sel" onchange="update(this.value)">
        <option value="http://ams2.runescape.com/lang/en/aff/runescape/game.ws?lowmem=1&amp;plugin=0">1</option>
        <option value="http://mi6.runescape.com/lang/en/aff/runescape/game.ws?lowmem=1&amp;plugin=0">2</option>
        <option value="http://ul5.runescape.com/lang/en/aff/runescape/game.ws?lowmem=1&amp;plugin=0">3</option>
        </select>
        
        <center>
        <iframe src="" id="worldurl"></iframe>
        </center>
        
        </body>
        </html>
        markaylward.co.uk

        Comment


        • #5
          If I were in the same room as you now....I would kiss you!!

          I have been tyring to figure that out all day, before coming here and receiving your excellent help. I Ave added a positive note on your reputation level (Or what ever it is called).

          Thanks again!!

          Comment


          • #6
            Hehe, no problem; thanks!
            markaylward.co.uk

            Comment

            Working...
            X