getting and changing iframe location text

Discussion in 'JavaScript' started by Shamsher Nawaz, Nov 9, 2006.

  1. #1
    How do i get and change an iframe src/content.

    
    <html>
    <head>
    <SCRIPT LANGUAGE="javascript">
        function getname()
        {
             alert("your current location is : " + [COLOR="Red"]???????[/COLOR]);
        }
    
        function changename()
        {   
             [COLOR="Red"]document.ifram1.src = "www.xyz.com";[/COLOR]
             alert("your current location is : " + [COLOR="Red"]???????[/COLOR]);
        }
    
      </SCRIPT>
    </head>
    <frameset ROWS="5%,*">
        <input type="button" onclick="getname();" />
        <input type="button" onclick="changename();" />
    
        <iframe SRC="http://www.abc.com" NAME="frame1">
    </frameset>
    
    </html>
    
    
    
    
    Code (markup):
     
    Shamsher Nawaz, Nov 9, 2006 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Try document.frames[0].location. or document.frames['frame1'].location.
     
    nico_swd, Nov 9, 2006 IP