JavaScript

Page 248

window.moveTo(ix,iy); } //停止窗口的滚动,回到原始位置 function StopMove() { clearInterval(TimerID); CenterWindow(); } //全屏化浏览器窗口 function FullWindow() { //判断浏览器类型 //若浏览器为 NN if(navigator.appName=="Netscape") { ix=screen.availLeft; iy=screen.availTop; iwidth=screen.availWidth; iheight=screen.availHeight; window.moveTo(ix,iy); window.resizeTo(iwidth,iheight); } //若浏览器为 IE else if(navigator.appName=="Microsoft Internet Explorer") { ix=0; iy=0; iwidth=screen.Width; iheight=screen.Height; window.moveTo(ix,iy); window.resizeTo(iwidth,iheight); } //否则,输出警告信息 else alert("对不起,当前浏览器类型不支持!"); } //--> </script> </head> <body> <center> <P>顺序单击如下按钮,实现窗口准确定位<p> <form name="MyForm"> <input type="button" value="初始化浏览器窗口" onclick="InitWindow()"><br> <input type="button" value="将浏览器窗口居中" onclick="CenterWindow()"><br> <input type="button" value="开始目标窗口移动" onclick="StartMove()"><br> <input type="button" value="停止目标窗口移动" onclick="StopMove()"><br> <input type="button" value="全屏化浏览器窗口" onclick="FullWindow()"><br> </form> </center> </body> </html>

程序运行后,原始页面如图 7.33 所示。


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.