Window open() Method - Open a new window called "MsgWindow", and write some text into it: - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window open

Description

Window open() 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  w  w .jav a 2s.c om*/
    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