Javascript Browser Window open() Method open a window with title

Introduction

Open a new window called "MsgWindow", and write some text into it:

Click the button to open a new window called "MsgWindow" with some text.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*ww w  .ja v  a2 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>



PreviousNext

Related