Create a window with the open()
method, and return the name of the new window:
Click the button to create a window and then display the name of the new window.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from w w w . j ava 2 s. c o m var myWindow = window.open("", "MsgWindow", "width=200,height=100"); myWindow.document.write("<p>This window's name is: " + myWindow.name + "</p>"); } </script> </body> </html>
The name property sets or gets the name of the window.
This property is used to modify the name of a window, after the window has been created.
Property Values
Value | Type | Description |
---|---|---|
winName | String | Specifies the name of the window |
If the name is not specified, this property returns "view"