2020.04.06 BOM in the Window object

<! DOCTYPE HTML> 
<HTML lang = "EN">
<head>
<Meta charset = "UTF-. 8">
<title> the Window Object </ title>

</ head>
<body>
<INPUT type = "Button" value = "open window" the above mentioned id = "the Button">
<the INPUT of the type = "the Button" value = "close that window has been opened," the above mentioned id = "closeW">
<Script>
/ *
window: window object
1. create
2. method
1 methods and pop-related
alert (): displays with some news and a confirmation alert box button
confirm (): displays a dialog box with a message and some OK button and cancel buttons.
If you click to confirm true if you click Cancel returns false if
prompt (): Display dialog can prompt for user input.
The return value of the input value
2. The method associated with the opening-closing:
open (): open a new browser window
to return a new window object
close (): Close the browser window
who calls off who
3. Properties
4. Features
* window objects do not need to create a window can be used to directly use the window method. name ()
* method window can omit name ();
* /
/ * Alert ( "the Hello window");
window.alert ( "the Hello aojie"); * /

/ * var = Confirm The Flag ( "Are you sure you want to quit? ");
IF (In Flag) {
document.write ( '<IMG the src =' IMG / banner_3.jpg '>");
} * /

// input box
/ * var result = prompt ( "Please enter your name:") ;
alert(result);*/

var openWindow=document.getElementById("button");
var newWindow;
var closeWindow=document.getElementById("closeW");
openWindow.onclick=function () {
newWindow=open("http://www.baidu.com");
}
closeWindow.onclick=function () {
newWindow.close();
}

</script>
</body>
</html>

Guess you like

Origin www.cnblogs.com/aojie/p/12649828.html