本帖最后由 xiebinyuxyz 于 2012-12-22 11:07:04 编辑

解决方案 »

  1.   

    <html>
     <head>
     <title>焦点定位</title>
     <script language="javascript">
     var newWindow=null;
     function makeNewWindow() {
       if(!newWindow||newWindow.closed) {
         newWindow=window.open("","","width=150,height=150");
     
         var newContent="<html><head><title>新建一个窗口</title></head>";
         newContent+="<body bgcolor=\"blue\"><h1>一个新的窗体测试</h1>>";
         newContent+="<form><input type=\"button\" value=\"切换一个新的窗体\" onclick=\"self.opener.focus()\"><br><br>";
         newContent+="<input type=\"button\" value=\"返回上一窗体\" onclick=\"self.blur()\">";
         newContent+="</form></body></html>";
         newWindow.document.write(newContent);
         newWindow.document.close();
       } else {
           newWindow.close();
       }
     }
     </script>
     </head>
     <body>
     <form>
     <input type="button" name="newOne" value="打开新的窗体" onclick="makeNewWindow()">
     </form>
     </body>
     </html>