<script language= "JavaScript" > Function Openwin (U, W, h) {var L = (screen.width-w)/2; var t = (screen.height-h)/2; var s = ' width= ' + w + ', height= ' + H + ', top= ' + t + ', left= ' + L; s + = ', Toolbar=no, Scrollbars=no, Menubar=no, Location=no, Resizable=no '; Open (U, ' Owin ', s); } </script> Test
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
JavaScript Pop-up Window Center code
Here are two examples of a pop-up screen centered window
Copy Code code as follows:
window.open () way
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 Way
Copy Code code 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 ");
}
Notice the second argument here, window
Users must enter information in this pop-up form before they can access other forms that are modal forms. Just use the second method.
JavaScript pop-up window centered four:
Copy Code code as follows:
function Selectcustomer () {
var itop = (window.screen.availheight-30-500)/2;
var ileft = (window.screen.availwidth-10-750)/2;
window.open (".. /customer/creditapprmanage.do?method=togetcustomer ",
"Searchcorp",
"Height=500,width=750,top=" +itop+ ", left=" +ileft+ ", toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location =no,status=no "
);
}
Description: 500 and 750 are hard-coded and can be passed in by parameter.