Javascript examples for DOM HTML Element:IFrame
The IFrame object represents an HTML <iframe> element.
You can access an <iframe> element by using getElementById():
<!DOCTYPE html> <html> <body> <iframe id="myFrame" src="http://java2s.com"></iframe> <button onclick="myFunction()">get the URL of the iframe</button> <p id="demo"></p> <script> function myFunction() {// www. ja v a 2 s . c o m var x = document.getElementById("myFrame").src; document.getElementById("demo").innerHTML = x; } </script> </body> </html>