1.
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <title>无标题页</title> 7 <script language="javascript"> 8 function onWindow(){ 9 myWindow = window.open('','','width=200,height=200'); 10 myWindow.document.write('<p>这是我的窗口</p>'); 11 } 12 <!-- 13 self等与window自身 14 window.moveTo();移动窗口 15 --> 16 function moveWindow(){ 17 myWindow.self.moveTo(0,0); 18 myWindow.self.focus(); 19 } 20 <!-- 21 22 screen:屏幕 23 screen:availWidth 屏幕允许的最大宽度 24 screen.availHeight屏幕允许的最大高度 25 --> 26 function MaxWindow(){ 27 myWindow.self.resizeTo(screen.availWidth, screen.availHeight) 28 } 29 </script> 30 </head> 31 <body> 32 <input type="button" value="打开窗口" onclick="onWindow()"> 33 <input type="button" value="移动窗口" onclick="moveWindow()"> 34 <input type="button" value="窗口最大化" onclick="MaxWindow()"> 35 </body> 36 </html>