How to use and parameter description
1. () Support environment:
JavaScript1.0+/JScript1.0+/Nav2+/IE3+/Opera3+
2. Basic syntax:
(pageURL,name,parameters)
in:
pageURL is the child window path
name is the child window handle
parameters are window parameters (each parameters are separated by commas)
3. Various parameters
Among them, yes/no can also be used 1/0; pixel value is the specific value, unit pixel.
Parameters | Value range | Description | |
alwaysLowered | yes/no | Specified windows are hidden behind all windows
alwaysRaised | yes/no | Specify windows suspended over all windows
depended | yes/no | Whether to close the parent window at the same time
directories | yes/no | Are the directory columns of Nav2 and 3 visible
height | pixel value | window height
hotkeys | yes/no | Set safe exit hotkey in window without menu bar
innerHeight | pixel value | pixel height of the document in the window
innerWidth | pixel value | pixel width of the document in the window
location | yes/no | Is the location bar visible
menubar | yes/no | Is the menu bar visible
outerHeight | pixel value | Set the pixel height of the window (including decorative borders)
outerWidth | pixel value | Set the pixel width of the window (including decorative borders)
resizable | yes/no | Is the window size resizable
screenX | pixel value | The pixel length of the window to the left border of the screen
screenY | pixel value | The pixel length of the window to the upper boundary of the screen
scrollbars | yes/no | Is there a scrollbar available in the window
titlebar | yes/no | Is the window title column visible
toolbar | yes/no | Is the window toolbar visible
Width | pixel value | Pixel width of the window
z-look | yes/no | Whether the window floats on other windows after it is activated
Next, I will take you to analyze its mystery.
【1. The most basic pop-up window code】
In fact, the code is very simple:
[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]
Because it is a piece of javascripts code, they should be placed in <SCRIPT LANGUAGE="javascr
Between ipt">tags and </script>.<!-- and --> work for some browsers with lower versions, in which the code in the tag will not be displayed as text. It is necessary to develop this good habit.
('') is used to control the pop-up of a new window, if
If it is not in the same path as the main window, the path, the absolute path (http://) and the relative path (..
Both are OK.
It is OK to use single and double quotes, but don't mix them.
This piece of code can be added to any location in HTML, between <head> and </head>, and between <body> and </body>, and the earlier it is executed, especially if the page code is long, try to put it forward if you want the page to pop up early.
【2. Pop-up window after setting】
Let’s talk about the settings of the pop-up window. Just add a little more to the above code.
Let's customize the appearance, size, and position of this pop-up window to suit the specific situation of the page.
[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]
Parameter explanation:
<SCRIPT LANGUAGE="javascript"> The js script starts;
Command to pop up a new window;
'' The file name of the pop-up window;
'newwindow' The name of the pop-up window (not the file name), if not required, it can be replaced by empty '';
height=100 window height;
width=400 window width;
top=0 The pixel value of the window from the top of the screen;
left=0 The pixel value of the window to the left of the screen;
toolbar=no Whether to display the toolbar, yes is the display;
menubar, scrollbars means menu bar and scrollbar.
resizable=no Whether to allow changing the window size, yes is allowed;
location=no Whether to display the address bar, yes is allowed;
status=no Whether to display information in the status bar (usually the file is already open), yes is allowed;
</SCRIPT> js script end
【3. Use functions to control pop-up windows】
Here is a complete code.
[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]
Here is a function openwin() defined, and the function content is to open a window. There is no use until it is called.
How to call it?
Method 1: <body onload="openwin()"> A pop-up window appears when the browser reads the page;
Method 2: <body onunload="openwin()"> A pop-up window appears when the browser leaves the page;
Method 3: Call with a connection:
<a href="#" onclick="openwin()">Open a window</a>
Note: The "#" used is a virtual connection.
Method 4: Call with a button:
<input type="button" onclick="openwin()" value="Open Window">
【4, 2 windows pop up at the same time】
Change the source code slightly:
[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]
To avoid overwriting the two pop-up windows, use top and left to control the pop-up position and do not overwrite each other.
. Finally, use the four methods mentioned above to call it.
Note: The names of the two windows (newwindows and newwindow2) should not be the same, or they are all empty.
OK?
[5. Open the file in the main window and pop up a small window at the same time]
The following code is added to the main window <head> area:
<script language="javascript">
<!--
function openwin() {
("","","width=200,height=200")
}
//-->
</script>
Join the <body> area:
<a href="" onclick="openwin()">open</a>.
【6. Timed closing control of pop-up window]
Let’s take some control over the pop-up window, and the effect will be even better. If we add a small piece of code to the pop-up page (note that it is added to the HTML, not the main page, otherwise...), wouldn't it be cooler to let it close automatically after 10 seconds?
First, add the following code to the <head> area of the file:
<script language="JavaScript">
function closeit() {
setTimeout("()",10000) //ms
}
</script>
Then, use the sentence <body onload="closeit()"> to replace the original <BO
DY>This sentence is enough. (Don't forget to write this sentence! The purpose of this sentence is to call the code that closes the window, and close the window yourself after 10 seconds.)
【7. Add a close button to the pop-up window】
<FORM>
<INPUT TYPE='BUTTON' VALUE='Close' onClick='()'>
</FORM>
Haha, it’s more perfect now!
【8. Pop-up windows included - two windows per page]
The above examples all contain two windows, one is the main window and the other is the pop-up window.
With the following example, you can complete the above effect in a page.
1. () Support environment:
JavaScript1.0+/JScript1.0+/Nav2+/IE3+/Opera3+
2. Basic syntax:
(pageURL,name,parameters)
in:
pageURL is the child window path
name is the child window handle
parameters are window parameters (each parameters are separated by commas)
3. Various parameters
Among them, yes/no can also be used 1/0; pixel value is the specific value, unit pixel.
Parameters | Value range | Description | |
alwaysLowered | yes/no | Specified windows are hidden behind all windows
alwaysRaised | yes/no | Specify windows suspended over all windows
depended | yes/no | Whether to close the parent window at the same time
directories | yes/no | Are the directory columns of Nav2 and 3 visible
height | pixel value | window height
hotkeys | yes/no | Set safe exit hotkey in window without menu bar
innerHeight | pixel value | pixel height of the document in the window
innerWidth | pixel value | pixel width of the document in the window
location | yes/no | Is the location bar visible
menubar | yes/no | Is the menu bar visible
outerHeight | pixel value | Set the pixel height of the window (including decorative borders)
outerWidth | pixel value | Set the pixel width of the window (including decorative borders)
resizable | yes/no | Is the window size resizable
screenX | pixel value | The pixel length of the window to the left border of the screen
screenY | pixel value | The pixel length of the window to the upper boundary of the screen
scrollbars | yes/no | Is there a scrollbar available in the window
titlebar | yes/no | Is the window title column visible
toolbar | yes/no | Is the window toolbar visible
Width | pixel value | Pixel width of the window
z-look | yes/no | Whether the window floats on other windows after it is activated
Next, I will take you to analyze its mystery.
【1. The most basic pop-up window code】
In fact, the code is very simple:
[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]
Because it is a piece of javascripts code, they should be placed in <SCRIPT LANGUAGE="javascr
Between ipt">tags and </script>.<!-- and --> work for some browsers with lower versions, in which the code in the tag will not be displayed as text. It is necessary to develop this good habit.
('') is used to control the pop-up of a new window, if
If it is not in the same path as the main window, the path, the absolute path (http://) and the relative path (..
Both are OK.
It is OK to use single and double quotes, but don't mix them.
This piece of code can be added to any location in HTML, between <head> and </head>, and between <body> and </body>, and the earlier it is executed, especially if the page code is long, try to put it forward if you want the page to pop up early.
【2. Pop-up window after setting】
Let’s talk about the settings of the pop-up window. Just add a little more to the above code.
Let's customize the appearance, size, and position of this pop-up window to suit the specific situation of the page.
[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]
Parameter explanation:
<SCRIPT LANGUAGE="javascript"> The js script starts;
Command to pop up a new window;
'' The file name of the pop-up window;
'newwindow' The name of the pop-up window (not the file name), if not required, it can be replaced by empty '';
height=100 window height;
width=400 window width;
top=0 The pixel value of the window from the top of the screen;
left=0 The pixel value of the window to the left of the screen;
toolbar=no Whether to display the toolbar, yes is the display;
menubar, scrollbars means menu bar and scrollbar.
resizable=no Whether to allow changing the window size, yes is allowed;
location=no Whether to display the address bar, yes is allowed;
status=no Whether to display information in the status bar (usually the file is already open), yes is allowed;
</SCRIPT> js script end
【3. Use functions to control pop-up windows】
Here is a complete code.
[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]
Here is a function openwin() defined, and the function content is to open a window. There is no use until it is called.
How to call it?
Method 1: <body onload="openwin()"> A pop-up window appears when the browser reads the page;
Method 2: <body onunload="openwin()"> A pop-up window appears when the browser leaves the page;
Method 3: Call with a connection:
<a href="#" onclick="openwin()">Open a window</a>
Note: The "#" used is a virtual connection.
Method 4: Call with a button:
<input type="button" onclick="openwin()" value="Open Window">
【4, 2 windows pop up at the same time】
Change the source code slightly:
[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]
To avoid overwriting the two pop-up windows, use top and left to control the pop-up position and do not overwrite each other.
. Finally, use the four methods mentioned above to call it.
Note: The names of the two windows (newwindows and newwindow2) should not be the same, or they are all empty.
OK?
[5. Open the file in the main window and pop up a small window at the same time]
The following code is added to the main window <head> area:
<script language="javascript">
<!--
function openwin() {
("","","width=200,height=200")
}
//-->
</script>
Join the <body> area:
<a href="" onclick="openwin()">open</a>.
【6. Timed closing control of pop-up window]
Let’s take some control over the pop-up window, and the effect will be even better. If we add a small piece of code to the pop-up page (note that it is added to the HTML, not the main page, otherwise...), wouldn't it be cooler to let it close automatically after 10 seconds?
First, add the following code to the <head> area of the file:
<script language="JavaScript">
function closeit() {
setTimeout("()",10000) //ms
}
</script>
Then, use the sentence <body onload="closeit()"> to replace the original <BO
DY>This sentence is enough. (Don't forget to write this sentence! The purpose of this sentence is to call the code that closes the window, and close the window yourself after 10 seconds.)
【7. Add a close button to the pop-up window】
<FORM>
<INPUT TYPE='BUTTON' VALUE='Close' onClick='()'>
</FORM>
Haha, it’s more perfect now!
【8. Pop-up windows included - two windows per page]
The above examples all contain two windows, one is the main window and the other is the pop-up window.
With the following example, you can complete the above effect in a page.