This article describes the method of reducing the window and centering after clicking on the link. Share it for your reference. The specific analysis is as follows:
This is a simple JS special effect. I have never seen it before. When clicking on the specified text link on the page, the page window will be narrowed and displayed in the center, and then the link content will be displayed in the center window. I hope these web page special effects will come in handy in the future.
Copy the code as follows: <HTML><HEAD>
<TITLE>Center the window</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
</HEAD>
<BODY bgColor=#fef4d9><BR><BR>
<CENTER>
<span>The window is zoomed out and centered</span>
</CENTER><BR>
<CENTER>
<TABLE borderColor=#00FFFF border=5 borderlight="green">
<TBODY>
<TR>
<TD align=middle><div align="center"><span>JS effect display</span></div></TD>
</TR>
<TR>
<TD align=left>
<div align="center">
<SCRIPT>
function this_win(w,h){
var ww=window.screen.width*w/100;
var hh=window.screen.height*h/100;
window.resizeTo(ww,hh);
window.moveTo(Math.ceil((window.screen.width-ww)/2),Math.ceil((window.screen.height-hh)/2));
}
</SCRIPT>
<A onclick=this_win(50,50) href="#">Click here to Baidu</A>
</div></TD></TR></TBODY></TABLE></CENTER>
</BODY>
</HTML>
I hope this article will be helpful to everyone's JavaScript programming.