First: <script language = "JavaScript" type = "text/JavaScript"> window. Location. href = "http://www.dollare.com.cn/login.php? Backurl = "+ window. Location. href;
</SCRIPT>
Type 2: <script language = "JavaScript"> alert ("return"); window. History. Back (-1); </SCRIPT>
Third: <script language = "JavaScript"> window. navigate ("dollare. php"); </SCRIPT>
Fourth: <script language = "JavaScript"> self.location+'dollare.htm'; </SCRIPT>
Fifth: <script language = "JavaScript"> alert ("illegal access! "); Top.location+'dollare.html; </SCRIPT>
1. directly jump to the window in the original form. location. href = "the page you want to jump to"; 2. Open the page in the new form using: window. open ('page to jump ');
Window. History. Back (-1); return to the previous page
3. Usage: <input name = "pclog" type = "button" value = "/go" onclick = "location. href = 'Connection address' "> link type: <a href =" javascript: history. go (-1) "> return to the previous page </a> <a href =" <% = request. servervariables ("http_referer") %> "> return to the previous page </a> jump type: <SCRIPT> window. location. href = 'Connection address'; </SCRIPT> open a window: <a href = "/JavaScript:" onclick = "window. open ('HTTP: // www.dolalre.com.cn ', '', 'height = 500, width = 611, scrollbars = Yes, status = Yes')"> 123 </a>
<SCRIPT> <! -- Window. Open
('Dollare.html ', 'newwindow', 'height = 100, width = 400, Top = 0, Left = 0, toolbar = No, menubar = No, scrollbars = No,
Resizable = No, location = No, status = no') // write a row -->
</SCRIPT>
After running the script, page.html will be opened in the newwindow of the new form, with a width of 100, a height of 400, 0 pixels from the screen top, 0 pixels left, no work
Bar, no menu bar, no scroll bar, no size adjustment, no address bar, no status bar. Please compare.
In the preceding example, several common parameters are involved. In addition, there are many other parameters. For details, see section 4.
Iv. Parameters
Here, yes/no can also use 1/0; pixel value is a specific value, in pixels.
Parameter | value range | description
Alwayslowered | yes/no | specifies that the window is hidden behind all windows
Alwaysraised | yes/no | specify the depended window on top of all windows | yes/no | whether to close both the window and the parent window
Directories | yes/no | whether the height is visible in the directory bar of nav2 and 3 | pixel value | window height
Hotkeys | yes/no | set the Security Exit hotkey in the window without menu bar
Innerheight | pixel value | pixel height of the document in the window
Innerwidth | pixel value | location of the document's pixel width in the window | yes/no | whether the location column is visible
Menubar | yes/no | whether the menu bar is visible
Outerheight | pixel value | set the pixel height of the window (including the decorative border)
Outerwidth | pixel value | set the pixel width of the window (including the decorative border)
Resizable | yes/no | whether the window size can be adjusted screenx | pixel value | the pixel length between the window and the left boundary of the screen
Screeny | pixel value | the pixel length between the window and the upper boundary of the screen. scrollbars | yes/no | whether the window can have a scroll bar
Titlebar | yes/no | visible toolbar in the window question bar | yes/no | visible in the window Toolbar
Width | pixel value | pixel width of the window Z-Look | yes/no | whether the window floats above other windows after being activated
========================================================== ==================
[1. The most basic pop-up window Code] the code is actually very simple:
<Script language = "JavaScript"> <! --
Window. Open ('dollare.html ') --> </SCRIPT>
Because it is a piece of javascripts code, they should be placed between the <script language = "JavaScript"> tag and </SCRIPT>
. <! -- And --> are used for some earlier browsers, and the code in the labels is not displayed as text in these old browsers. Yes
This is a good habit.
Window. Open ('dollare.html ') is used to control the new window page.html. If page.html is not in the same path as the main window,
The above should specify the path, absolute path (http://www.dollare.com.cn/dollare.html) and relative path (../) can be. You can use single quotes and double quotes, but do not mix them.
This piece of code can be added to any HTML location, either between , Especially the Page code is long. If you want the page to pop up early, try to move it forward.
[2. After setting, the pop-up window is displayed]
Let's talk about the settings in the pop-up window. You just need to add something to the code above.
We will customize the appearance, size, and position of the pop-up window to adapt to the specific situation of the page.
<Script language = "JavaScript"> <! --
Window. Open ('dollare.html ', 'newwindow', 'height = 100, width = 400, Top = 0, Left = 0, toolbar = No,
Menubar = No, scrollbars = No, resizable = No, location = No, status = no ')
// Write a line --> </SCRIPT> parameter explanation:
<Script language = "JavaScript"> JS script starts. Window. Open the new window command;
'Page.html 'indicates the name of the pop-up window. 'newwindow' indicates the name of the pop-up window (not a file name). It is optional and can be replaced by null;
Height = 100 window height; width = 400 window width; Top = 0 pixels between the window and the top of the screen;
Left = 0 the pixel value between the window and the left of the screen;
Width = 250, toolbar = No, scrollbars = "+ scroll +", menubar = No "); // write a row
Opentracing Doc ument. Write ("<title> dollare xiongzai studio </title> ")
Openmediaworkflow Doc ument. Write ("<body bgcolor = # ffffff> ")
Openmediaworkflow Doc ument. Write ("Openmediaworkflow Doc ument. Write ("new window opened! <Br> is good ")
Openmediaworkflow Doc ument. Write ("</body> ")
Openmediaworkflow Doc ument. Write ("Openmediaworkflow Doc ument. Close ()} </SCRIPT> <Body> <a href = "#" onclick = "openwin ()"> open a window. </a>
<Input type = "button" onclick = "openwin ()" value = "open window">
</Body> Check if the code in openmediaworkflow Doc ument. Write () is not standard HTML? You only need to write more rows according to the format. An error occurs when you add one or more labels. Remember to end with opentracing upload Doc ument. Close.
[9. Ultimate application-Cookie control in the pop-up window]
In retrospect, although the pop-up window above is cool, there is a little bit of a problem (immersed in joy, do not find it ?) For example, if you place the above script in a page that requires frequent access (such as the homepage), the window will pop up every time you refresh the page, isn't it very annoying? :-(Is there a solution? Yes! Follow me. We can use cookies to control it. First, add the following code to the <SCRIPT> function openwin ()
{Window. Open ("page.html", "", "width = 200, Height = 200 ")}
Function get_cookie (name) {var search = Name + "="
VaR returnvalue = ""; if (document. Cookie. length> 0 ){
Offset = Document. Cookie. indexof (Search) if (offset! =-1 ){
Offset + = search. Length End = Document. Cookie. indexof (";", offset );
If (END =-1) End = Document. Cookie. length;
Returnvalue = Unescape (document. Cookie. substring (offset, end ))}}
Return returnvalue;} function loadpopup (){
If (get_cookie ('popped') = ') {openwin ()
Document. Cookie = "popped = yes" }}</SCRIPT>
Then, use <body onload = "loadpopup ()"> (not openwin, but loadpop !) Replace the original <body> sentence on the home page. You can refresh the page or enter the page again, and the window will no longer pop up. Real pop-only-once!