Javascript examples for DOM HTML Element:IFrame
The name property sets or gets the name attribute in an iframe element.
Set the name property with the following Values
Value | Description |
---|---|
name | The name of the iframe |
A String, representing the name of the iframe
The following code shows how to get the name of an iframe:
<!DOCTYPE html> <html> <body> <iframe id="myFrame" src="http://java2s.com" name="iframe_a"></iframe> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w ww . ja v a2s .c o m*/ var v = document.getElementById("myFrame").name; document.getElementById("demo").innerHTML = v; } </script> </body> </html>