Mega Code Archive

 
Categories / JavaScript Tutorial / Window
 

Window name

The name property returns the name of the window. This property contains the name specified when new windows are created using the Window.open() method. <html>     <head>     <script language="JavaScript">     <!--     function openWin(){       var myBars = 'directories=no,location=no,menubar=no,status=no';       myBars += ',titlebar=no,toolbar=no';       var myOptions = 'scrollbars=no,width=400,height=200,resizeable=no';       var myFeatures = myBars + ',' + myOptions;       var newWin = open('', 'myDoc', myFeatures);       newWin.document.writeln('This window\'s name is: ' + newWin.name + '<br>');       newWin.document.writeln('<form>');       newWin.document.writeln('<input type=BUTTON value="Close"');       newWin.document.writeln(' onClick="window.close()">');       newWin.document.writeln('</form>');       newWin.document.close();     }     -->     </script>     </head>     <body>     <form>       <input type=BUTTON value="Open" onClick="openWin()">     </form>     </body>     </html>