Javascript
How do I use JavaScript to open a window? It is an insult to the wisdom of our web programmers!
However, today, users put forward a new demand, he will pop out of the window to be in the middle of the entire screen!
So, Google, find a lot of people reprinted articles as follows:
<script language= "JavaScript" >
var s = "";
S + + Web page visible area wide: + document.body.clientWidth;
S + + "Web page visible Area High:" + document.body.clientHeight;
S + + page visible area wide: "+ document.body.offsetwidth +" (including Edge and scroll bar width);
S + + page visible Area High: "+ Document.body.offsetHeight +" (including the edge of the width);
S + + page body Full text width: "+ document.body.scrollWidth;
S + = "The full text of the page is high:" + document.body.scrollHeight;
S + + pages are rolled High: "+ document.body.scrollTop;" The
S + + page is rolled away to the left: "+ document.body.scrollLeft;"
S + + page body part: "+ window.screentop;"
S + + page body part left: "+ window.screenleft;"
S + = "high screen resolution:" + window.screen.height;
S + + screen resolution width: + window.screen.width;
S + + screen available Workspace height: + window.screen.availHeight;
S + + screen available workspace width: + window.screen.availWidth;
S + + "your screen setting is" + window.screen.colorDepth + "bit color";
S + + "your screen settings" + Window.screen.deviceXDPI + "pixel/inch";
Alert (s);
</SCRIPT>
This article is not difficult to write code that opens the window in the middle of the screen:
function Openbrwindowincentre (theurl,width,height) {
var left, top;
left = (window.screen.availwidth-width)/2;
top = (window.screen.availheight-height)/2;
var per = ' width= ' + width + ', height= ' + height + ', left= ' + Left + ', top= ' + Top + ', screenx= ' + Left + ', screeny= ' + to P
window.open (theURL, "", per);
}
In the code, because the pop-up window is not too large, no processing pop-up window than the large screen, we recommend that you modify the actual situation.