[3. Function Control pop-up window]
The following is a complete code:
<Html> 〉
<Head> 〉
<Script LANGUAGE = "JavaScript"> "〉
<〈! --
Function openwin (){
Window. open ("page.html", "newwindow", "height = 100, width = 400, toolbar = no, menubar = no, scrollbars = no, resizable = no, location = no, status = no ")
// Write a row
}
// --> //--〉
</Script> 〉
</Head> 〉
<Body onload = "openwin ()"> ()"〉
... Any page content...
</Body> 〉
</Html> 〉
A function openwin () is defined here, and the function content is to open a window. There is no purpose before calling it.
How to call it?
Method 1: The window pops up when the browser reads the page;
Method 2: The window pops up when the browser leaves the page;
Method 3: call with a connection: <a href = "#" onclick = "openwin ()"> open a window </a> 〉
Note: "#" is a virtual connection.
Method 4: call with a button: <input type = "button" onclick = "openwin ()" value = "open window"> "〉
4. Two windows are displayed at the same time]
Slightly modify the source code:
<Script LANGUAGE = "JavaScript"> "〉
<〈! --
Function openwin (){
Window. open ("page.html", "newwindow", "height = 100, width = 100,
Top = 0, left = 0, toolbar = no, menubar = no, scrollbars = no, resizable = no,
Location = no, status = no ")
// Write a row
Window. open ("page2.html", "newwindow2", "height = 100, width = 100,
Top = 100, left = 100, toolbar = no, menubar = no, scrollbars = no, resizable = no,
Location = no, status = no ")
// Write a row
}
// --> //--〉
</Script> 〉
To avoid overwriting the two pop-up windows, use top and left to control the position of the pop-up window. Finally, use the four methods mentioned above to call.
Note: The names of the two windows (newwindows and newwindow2) must not be the same, or they are all empty. OK?