Created
April 2, 2012 19:52
-
-
Save h4/2286767 to your computer and use it in GitHub Desktop.
Объект window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function openWin() { | |
| myWindow = window.open("", "", "width=200,height=100"); | |
| myWindow.document.write("Вот оно - 'myWindow'!"); | |
| myWindow.focus(); | |
| myWindow.opener.document.write("Это окно, из которого открыли новое окно"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script type="text/javascript"> | |
| function openWin() { | |
| myWindow=window.open("","","width=200,height=100"); | |
| myWindow.document.write("<p>Это окно - 'myWindow'</p>"); | |
| } | |
| function closeWin() { | |
| myWindow.close(); | |
| } | |
| function checkWin() { | |
| if (myWindow.closed) { | |
| document.getElementById("msg").innerHTML="'myWindow' закрыто!"; | |
| } else { | |
| document.getElementById("msg").innerHTML="'myWindow' не закрыто!"; | |
| } | |
| } | |
| </script> | |
| </head> | |
| <body> | |
| <input type="button" value="Открыть 'myWindow'" onclick="openWin()" /> | |
| <input type="button" value="Закрыть 'myWindow'" onclick="closeWin()" /> | |
| <br /> | |
| <input type="button" value="Окно 'myWindow' закрыто?" onclick="checkWin()" /> | |
| <br /> | |
| <div id="msg"></div> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function moveWin() { | |
| myWindow.moveBy(250,250); | |
| myWindow.focus(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function resizeWindow() { | |
| myWindow.resizeTo(500,300); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function open_win() { | |
| window.open("http://www.w3schools.com","_blank","toolbar=yes, location=yes, directories=no,status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400,height=400"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <head> | |
| <title>открыть окно</title> | |
| <script type="text/javascript"> | |
| function openWin() { | |
| myWin= open("", "displayWindow", "width=500,height=400,status=yes,toolbar=yes,menubar=yes"); | |
| myWin.document.open(); | |
| myWin.document.write("<html><head><title>на_лету</title></head><body>"); | |
| myWin.document.write("<font size=+3>"); | |
| myWin.document.write("Этот HTML-документ был создан с помощью JavaScript!"); | |
| myWin.document.write("</font></body></html>"); | |
| myWin.document.close(); | |
| } | |
| </script> | |
| </head> | |
| <body> | |
| <form> | |
| <input type="button" value="создай страницу на лету!" onclick="openWin();"> | |
| </form> | |
| </body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment