Document write() Method - Open a new window called "MsgWindow", and write some text into it: - Javascript DOM

Javascript examples for DOM:Document write

Description

Document write() Method - Open a new window called "MsgWindow", and write some text into it:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<script>
function myFunction() {/*from  w  ww .  j a  v  a 2  s .c o m*/
    var myWindow = window.open("", "MsgWindow", "width=200,height=100");
    myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>");
}
</script>

</body>
</html>

Related Tutorials