窗口的新建移动和改变大小
7-50 课堂演示
newWindow=window.open('','','top=150,left=150,width=300,height=300')
newWindow.close()
newWindow.moveTo(300,300)
newWindow.moveBy(30,30)
newWindow.resizeBy(30,30)
newWindow.resizeTo(30,30)
1 <!DOCTYPE html> 2 <html lang="zh-cn"> 3 <head> 4 <meta charset="utf-8"> 5 <title>7-50 课堂演示</title> 6 <link rel="stylesheet" type="text/css" href="style.css"> 7 <style type="text/css"> 8 </style> 9 </head> 10 <body> 11 <input type="button" value="open新窗口" onclick="openBtn()"> <br> 12 <input type="button" value="close新窗口" onclick="closeWin()"> <br> 13 <input type="button" value="moveTo新窗口" onclick="moveWin()"> <br> 14 <input type="button" value="moveBy新窗口" onclick="moveWin()"> <br> 15 <input type="button" value="sizeBy新窗口" onclick="moveWin()"> <br> 16 <input type="button" value="moveTo新窗口" onclick="moveWin()"> <br> 17 <script> 18 // 打开和关闭窗口练习 19 var newWindow; 20 function openWin(){ 21 newWindow=window.open('','','top=150,left=150,width=300,height=300') 22 } 23 function closeWin(){ 24 newWindow.close() 25 } 26 function moveWin1(){ 27 newWindow.moveTo(300,300) 28 newWindow.focus() 29 } 30 function moveWin2(){ 31 newWindow.moveBy(30,30) 32 newWindow.focus() 33 } 34 function sizeWin1(){ 35 newWindow.resizeBy(30,30) 36 newWindow.focus() 37 } 38 function sizeWin2(){ 39 newWindow.resizeTo(30,30) 40 newWindow.focus() 41 } 42 </script> 43 </body> 44 </html>