IFrame name Property - Change the name of an iframe: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:IFrame

Description

IFrame name Property - Change the name of an iframe:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<iframe id="myFrame" src="/default.asp" name="iframe_a"></iframe>

<p>Click the button to change the name of the iframe.</p>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from  www  .j  a v  a2 s.  co  m*/
    document.getElementById("myFrame").name = "newIframeName";
    document.getElementById("demo").innerHTML = "The name of the iframe was changed from 'iframe_a' to 'newIframeName'.";
}
</script>

</body>
</html>

Related Tutorials