JS automatically opens the website and controls the closing of a window page

From , 5 Years ago, written in JavaScript, viewed 120 times.
URL https://pastebin.vip/view/99be9f83
  1. <html>
  2. <head>
  3. <title>打开多个窗口</title>
  4. <script type="text/javascript">
  5. myWebpage1=window.open("","myWebpage1","width=200,height=100");
  6. myWebpage2=window.open("","myWebpage2","width=200,height=100");
  7. myWebpage3=window.open("http://www.baidu.com");
  8. myWebpage1.document.write("这是第一个窗口!");
  9. myWebpage1.document.write("<HEAD><TITLE>新窗口一</TITLE></HEAD>");
  10. myWebpage2.document.write("这是第二个窗口!");
  11. myWebpage2.document.write("<HEAD><TITLE>新窗口二</TITLE></HEAD>");
  12. function closeWin()
  13.   {
  14. switch(form1.Select1.selectedIndex)
  15. {
  16. case 0:
  17. myWebpage1.close();
  18. alert("新窗口一已经关闭!");
  19. break;
  20. case 1:
  21. myWebpage2.close();
  22. alert("新窗口二已经关闭!")
  23. break;
  24. case 2:
  25. myWebpage3.close();
  26. alert("http://www.baidu.com已经关闭!")
  27. break;
  28. }
  29.   }
  30.  
  31. </script>
  32. <style type="text/css">
  33. #Select1 {
  34.         width: 102px;
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <div style="background-color: #9acdcd">
  40.   <form name="form1"  id="form1">
  41.     <p>请选择要关闭的窗口:
  42.       <select id="Select1" name="D1">
  43.         <option>新窗口一</option>
  44.         <option>新窗口二</option>
  45.         <option>百度</option>
  46.       </select>
  47.       <input id="Button1" type="button" value="关闭"  onclick="closeWin()"/>
  48.   </form>
  49. </div>
  50. </body>
  51. </html>
  52.  

Reply to "JS automatically opens the website and controls the closing of a window page"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website