IFrame srcdoc Property - Return the HTML content that is shown in an iframe: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:IFrame

Description

IFrame srcdoc Property - Return the HTML content that is shown in an iframe:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<iframe id="myFrame" srcdoc="<p>Hello world!</p>" src="demo_iframe.htm"></iframe>

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

<script>
function myFunction() {/*  w  w  w.  ja  v a2  s. c  o  m*/
    var v = document.getElementById("myFrame").srcdoc;
    console.log(v);
}
</script>

</body>
</html>

Related Tutorials