-----027-Window-Name.html-----
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>标题</title> </head> <body> <script type="text/javascript"> function getTime() { if(newWin.closed) { window.clearInterval(intervalID); window.alert(name + "窗口打开了" + t + "秒"); } else { t++; } } function openNew() { newHtml = "<h4>打开新窗体</h4><center><input type='button', value='关闭'onclick='window.opener=null; window.close();'/></center>" newWin = window.open("", "新窗口", "height=200, width=200, toolbar=no, menubar=no, status=yes, location=no, top=200, left=200"); newWin.name="蜡笔小新"; newWin.document.write(newHtml); t = 0; name = newWin.name; intervalID = window.setInterval(getTime, 1000); } </script> <input type="button" value="New" onclick="openNew()"/> </body> </html>