<html>
<body>
<script id="myScript">
document.write("Hello World!");
</script>
<p>Click the button to return the contents of the script element.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myScript").text;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_script_text by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 18:17:02 GMT -->
</html>