View Single Post
  #1 (permalink)  
Old 01-04-09, 01:54 PM
Newb-Man's Avatar
Newb-Man Newb-Man is offline
Newbie Coder
 
Join Date: Mar 2006
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
How do I get the URL of an iframe

Hey, I find myself in the same bind as these folks down in a quite old (and very dead) post. The problem involves not being able to get the updated url of a frame. It is easy to find the url, but when I try to update it on page change, I get access errors

Here's the article

The current code I use looks like this.

Frameset
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank you for surfing 2 save...</title>
<script type="text/javascript">
function CheckURL()
{
    parent.topFrame.makeitupdate();
    

}
</script>
</head>

<frameset rows="132,*" cols="*" framespacing="0" frameborder="no" border="0">
  <frame src="surfframe.html" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="surf2save" style="height:132px;" />
  <frame src="content.html" name="mainFrame" id="mainFrame" title="content" onLoad="CheckURL()" />
</frameset>

<noframes>


<body>



</body>
</noframes>
</html>
topFrame
HTML 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=utf-8" />
<title>Surf2Save</title>

<script type="text/javascript">
//<![CDATA[


function GoToLocation()
{
    var GoToPage = document.getElementById('GoToPage');
    window.top.mainFrame.location=GoToPage.value; 
}

function makeitupdate()
{

    
    alert(parent.mainFrame.location);

}
//]]>
</script>

</head>

<body>


<div style="text-align:center">
    
    <input type="text" name="GoToPage" id="GoToPage" class="url" value="http://google.com" /><a href="#" onClick="GoToLocation();" ><img src="go.png" class="go" alt="Surf2Save" /></a>

    
</div>


</body>
</html>
Many Many Thanks in Advance
__________________
Why not check out my website
EXPIRINGLINKS.CO
EXPIRINGLINKS.CO

It's allows you to make secure, encrypted links that expire when tell them to (or not at all if you wish). The best thing for posting links on forums.
Reply With Quote