moveTo()方法格式:window.moveTo(x,y);
功能:将窗口移动到指定坐标(x,y)处;
resizeTo()方法格式:window.resizeTo(x,y);
功能:将当前窗口改变成(x,y)大小,x、y分别为宽度和高度;
resizeBy()方法格式:window.resizeBy(x,y);
功能:将当前窗口改变到指定的大小(x,y),当x、y的值大于0时为扩大,小于0时为缩小。
实现过程:
1 <script language=JavaScript> 2 var winheight,winsize,x; 3 function go1(){ 4 winheight=100; 5 winsize=100; 6 x=5; 7 win2=window.open("abc.html","","scrollbars='no'"); 8 win2.moveTo(0,0); 9 win2.resizeTo(100,100); 10 go2(); 11 } 12 function go2(){ 13 if (winheight>=screen.availHeight-3) 14 x=0; 15 win2.resizeBy(5,x); 16 winheight+=5; 17 winsize+=5; 18 if (winsize>=screen.width-5){ 19 winheight=100; 20 winsize=100; 21 x=5; 22 return; 23 } 24 setTimeout("go2()",50) 25 } 26 </script> 27 <a href="javascript:go1()">打开明日美食留言薄</a>