Skype - Sciences in 2007 - Find services - Find jobs - Shopping news

PDA

View Full Version : How to get URL of a Frame?


phantom
Nov 19th 2006, 8:31 am
How would I go about diplaying/getting the URL of a frame from another frame.

All I want to do really is, while in 1 frame get the URL of another frame with javascript so I can use the data in php a script

Thanks

mani
Nov 21st 2006, 5:39 am
is it a frame or IFrame? try giving a name to the frame and use the src property


var framURL= frameName.src;

phantom
Nov 21st 2006, 6:31 am
Yes it is a frame. The Frame's name is "mainFrame" So What I need to do is from the top frame, get the URL of mainFrame and store it in a variable for later use. Could you give me an example of how I would implement your code example in a script? I really am a javascript noob.

Thank you in advance for your help.

phantom
Nov 21st 2006, 7:15 am
This is what I have so far but doesn't work. Any ideas?


<script language="javascript" type="text/javascript">
function geturl() {
var mainurl = mainFrame.src;
document.write (mainurl);
}
</script>



<a href="javascript:geturl();" target="_blank">Report</a>