Technical summary sharing of javascript pop-up windows
小云云
Release: 2023-03-21 14:16:01
Original
1309 people have browsed it
This article mainly shares with you the technical summary of javascript pop-up windows. Here are some pop-up window parameters. You can set them by yourself. The parameters are optional and separated by commas. String --List the object table separated by commas. Each item has its own value, and they will be separated (eg: "fullscreen=yes, toolbar=yes"). The following are the various features that are supported.
channelmode = { yes | no | 1 | 0 }
Whether to display the ladder mode in the window
The default is no
directories = { yes | no | 1 | 0 }
Whether to display various buttons in the window
The default is yes
fullscreen = { yes | no | 1 | 0 }
Whether to display the browser in full screen mode
The default is no
height = number
Specify the height of the window, the unit is pixels
The minimum value is 100
left = number
Specify The distance between the window and the left border, in pixels
The value must be greater than or equal to 0
location = { yes | no | 1 | 0 }
Specify whether to display the address bar in the window
The default is yes
menubar = { yes | no | 1 | 0 }
Specify whether to display the address bar in the window Display the menu bar in the window
The default is yes
resizable = { yes | no | 1 | 0 }
Specify whether to display the resizable menu bar in the window Handle for user resizing
Default is yes
scrollbars = { yes | no | 1 | 0 }
Specifies whether to display in the window Horizontal or vertical scroll bar
The default is yes
status = { yes | no | 1 | 0 }
Specifies whether to display status in the window Column
Defaults to yes
##titlebar = { yes | no | 1 | 0 }
Specifies whether to display the title bar in the window. In the case of non-calling HTML Application or a dialog box, this item will be ignored
The default is yes
##toolbar = { yes | no | 1 | 0 }
Specify whether to display the toolbar in the window, including buttons such as forward, back, stop, etc.
The default is yes
##width = number
Specify the width of the window, the unit is pixels
The minimum value is 100
top = number
Specify the position of the top of the window, The unit is pixels
Because this is a piece of javascripts code, they should be placed between
.
works on some older browsers. In these old browsers, the code in the tag will not be displayed as text. Develop this good habit. window.open ('page.html') is used to control the pop-up of a new window page.html. If page.html is not in the same path as the main window, the path should be stated in front, absolute path (http://) and relative Any path (../) is acceptable. You can use either single quotes or double quotes, just don't mix them. This piece of code can be added to any position in the HTML, between and or between. The earlier the code is, the earlier it will be executed. Especially if the page code is long and you want the page to pop up earlier, try to put it as far forward as possible.
2. The pop-up window after setting
Let’s talk about the settings of the pop-up window. Just add a little more to the code above. Let's customize the appearance, size, and pop-up position of this pop-up window to suit the specific conditions of the page.
#'page.html' The file name of the pop-up window; 'newwindow' The name of the pop-up window (not the file name), optional, can be replaced by empty ''; Height=100 window height; width =400 window width; Top=0 pixel value from the window to the top of the screen; left=0 pixel value from the window to the left side of the screen; toolbar=no whether to display the toolbar, yes means display ; Menubar, scrollbars represent menu bars and scroll bars. resizable=no Whether to allow the window size to be changed, yes is allowed; location=no Whether to display the address bar, yes is allowed; status=no Whether to display the information in the status bar (usually the file has been opened) ), yes is allowed; End of js script
A function openwin() is defined here, and the content of the function is to open a window. It serves no purpose until it is called. How to call it? Method one: A window pops up when the browser reads the page;
Area: open. 6. Timing closing control of pop-up windows Next we will perform some control on the pop-up windows, and the effect will be better. Wouldn't it be cooler if we added a small piece of code to the pop-up page (note that it is added to the HTML of page.html, not the main page), so that it automatically closes after 10 seconds?
First, add the following code to the area of the page.html file:
<script language="JavaScript">
function closeit()
{
setTimeout("self.close()",10000)
//毫秒
}
</script>
The above is the detailed content of Technical summary sharing of javascript pop-up windows. For more information, please follow other related articles on the PHP Chinese website!
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn