This article mainly summarizes the use of forms in JS. If you need it, you can refer to it and hope to help you. 1. How to refresh the page in javascript
Window. location. reload ();
Use window. open () to refresh the parent window.
Window. opener. location. reload ()
Window. showDialog
Window. dialogArguments. location. reload ();
2. Two implementation methods for the javascript pop-up window-the following example shows two pop-up screen center windows.
Window. open () method
The Code is as follows:
Function ShowDialog (url ){
Var iWidth = 300; // window width
Var iHeight = 200; // window height
Var iTop = (window. screen. height-iHeight)/2;
Var iLeft = (window. screen. width-iWidth)/2;
Window. open (url, "Detail", "Scrollbars = no, Toolbar = no, Location = no, Direction = no, Resizeable = no,
Width = "+ iWidth +", Height = "+ iHeight +", top = "+ iTop +", left = "+ iLeft );
}
Window. showModalDialog Mode
The Code is as follows:
Function ShowDialog (url ){
Var iWidth = 300; // window width
Var iHeight = 200; // window height
Var iTop = (window. screen. height-iHeight)/2;
Var iLeft = (window. screen. width-iWidth)/2;
Window. showModalDialog (url, window, "dialogHeight:" + iHeight + "px; dialogWidth:" + iWidth + "px;
DialogTop: "+ iTop +"; dialogLeft: "+ iLeft +"; resizable: no; status: no; scroll: no ");
}
Note that the second parameter here is window
3. Set the method for not caching data on the page
Add the following statement to the jsp page:
The Code is as follows:
<%
Response. setHeader ("Pragma", "No-Cache ");
Response. setHeader ("Cache-Control", "No-Cache ");
Response. setDateHeader ("Expires", 0 );
%>
4. There is no prompt to close the page.
The Code is as follows:
Function CloseWin (){
Var ua = navigator. userAgent; var ie = navigator. appName = "Microsoft Internet Explorer "? True: false;
If (ie ){
Var IEversion = parseFloat (ua. substring (ua. indexOf ("MSIE") + 5, ua. indexOf (";", ua. indexOf ("MSIE "))));
If (IEversion <5.5 ){
Var str = '';
Document. body. insertAdjacentHTML ("beforeEnd", str );
Document. all. noTipClose. Click ();
} Else {
Window. opener = null; window. close ();
}
} Else {
Window. close ()
}
}
5. Close the pop-up window regularly --- set/clear the timer
The Code is as follows:
Scriptlanguage = "JavaScript"
! --
Functioncloseit (){
SetTimeout ("self. close ()", 100000) // The unit is millisecond. The unit is 100 seconds.
SetInterval ("self. close ()", 100000)
Window. clearTimeout (me. timer );
Window. clearInterval (me. timer );
/Script
6. In the javascript pop-up window, pass the value through url.
The Code is as follows: