Js Code (Classic + Useful + common)

Source: Internet
Author: User

Window. close the window. close the window without a system prompt.
========================================================== ==============
When we use this method: Response. Write ("<script> window. close () </script> ")
Always Prompt: the prompt that the webpage you are viewing is trying to close
How do I remove the prompt and close the form directly?
You can use the following methods:
Response. Write ("<script> window. opener = null; window. close () </script> ")
Only ie6 is supported.
Opener can be set to any value without any prompt

How can I close a parent form through a child form?
Subform (pop-up form ):
Likewise:
Response. Write ("<script> window. opener. top. opener = null; window. opener. top. close () </script> ")

========================================================== ================================
The simplest method is to close the window code without prompting (you can copy it directly ):
 
<Input type = "button" onClick = "window. opener = 'xxx'; window. close ();"
Value = "IE6 simplest window closed without prompt">
========================================================== ======================================
The following message is displayed when the window is closed:
<Input type = "button" onClick = "javascript: window. close ();" value = "close">
<A href = "javascript: window. close ();"> close </a>
========================================================== ======================================
Code for automatically closing the window:
<Script language = "javascript">
<! --
Function clock () {I = I-1
Document. title = "this window will be closed automatically after" + I + "seconds! "
If (I> 0) setTimeout ("clock ();", 1000 );
Else self. close ();}
Var I = 20
Clock ();
// -->
</Script>
After the following code is added to the source code of the webpage, the window will be automatically closed in 20 seconds! This works well with a small pop-up window! In the Code, "I = 20" indicates that the delay for disabling is 20 seconds, which can be modified at will.
========================================================== ======================================
No operation prompt. The window is closed automatically.
<Script> setTimeout ("window. opener = 'xxx'; window. close ();", 1000); </script>
========================================================== ======================================
How to hide the IE menu bar, toolbar, and address bar:
<Script language = "JavaScript">
<! --
Function MM_openBrWindow (theURL, winName, features) {// v2.0
Window. open (theURL, winName, features );
}
// -->
</Script>

<A href = "javascript:;" onClick = "MM_openBrWindow('s.html ', 'yy', 'width = 300, height = 300')"> link to the page address </a>
========================================================== ======================================
Set the window size and the window will be closed automatically without prompt:

<BODY onload = "top. resizeTo (300,300);">
<Div align = center> data is successfully inserted! <Br>
</Div>
<Script> setTimeout ("window. opener = 'xxx'; window. close ();", 2000); </script>
</BODY>
========================================================== ======================================
Click connection to bring up a specific window (hide the IE menu bar, toolbar, and address bar:

<A href = "s.html" onClick = "javascript: window. open (this. href, '_ blank', 'toolbar = no, location = no, directories = no, status = no, menubar = no, scrollbars = yes, resizable = no, top = 0, left = 0, width = 790, height = 545 '); return false "> New window </a>
========================================================== ==================================
This section describes how to set the window size, IE menu bar, toolbar, and address bar:

You can use resizeTo () to set the window size. The resizeBy () function adds this code to the <Script language = javascript> resizeTo (x, y) </script> or ()
X and y are the length and width of the window you want. dx and dy are the values you want to increase the length and width of the window. (Dx, dy) is reduced when it is a negative number.
Hide the toolbar. You must open a new window in the menu bar (the following code may vary with the formats of different browsers for IE. Do not press enter to wrap the line after opening !)
Window. open ("url", "window_name", "menubarbar = no, toolbar = no"> </script> 〉
<Script> the url is the address of the web page to be displayed in the new window, And window_name is the name of the window, which may be used for linking. If not, replace it, menubarbar (menu bar) toolbar (toolbar) locationbar (Address Bar) status (status bar) personalbar resizabla (whether to allow resizing) fullsreen (whether full screen) parameters can be used in the same format

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.