多点几次“open mywindow”按钮,“close mywindow”按钮就只能关闭最近的一个窗口,怎么回事儿?
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>多点几次“open mywindow”按钮,“close mywindow”按钮就只能关闭最近的一个窗口,怎么回事儿?</title> </head> <body> <input type="button" value="Open myWindow" onclick="openWin()"/> <input type="button" value="Close myWindow" onclick="closeWin()"/> <script type="text/javascript"> function openWin(){ myWindow=window.open("","","width=400,height=200"); myWindow.document.write("This is myWindow"); } function closeWin(){ myWindow.close(); } </script> </body> </html>