<html> <head> <script type="text/javascript"> <!-- function setSrc(obj, url) { obj.src = url; } function getSrc() { var obj = document.getElementById('myframe'); document.getElementById("frameid").value = obj.src; return false; // if we return false, then we don't go to the URL defined in the href (here #) } //--> </script> </head> <body> <p><b>|</b> <a href="#" onclick="return getSrc();">Get src</a> - displays with alert</p> <iframe id="myframe" src="http://www.google.com"></iframe> <br> <br> <input id="frameid" value="" name="frameid" /><p>frameurl not showing in input</p> </body> </html>