1.全屏显示窗口
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>全屏显示窗口</title> </head> <body> <div align="center"> <input type="button" name="FullScreen" value="全屏显示" onclick="window.open(document.location,'big','fullscreen=yes')" /> </div> </body> </html>
2.定时关闭窗口
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>定时关闭窗口</title> <script type="application/javascript"> var i=6; clock(); function clock() { document.title = "本窗口将在"+i+"秒后自动关闭!"; i --; if(i>0) setTimeout("clock()",1000); else { // 1.在Firefox地址栏里输入 about:config // 2.在配置列表中找到 dom.allow_scripts_to_close_windows // 3.点右键的选切换把上面的false修改为true即可。 //注:默认是false,是为了防止脚本乱关窗口 //FireFox中做如此设置以后,直接使用"window.close()"即可对窗口关闭。 //window.open('','_self','');针对chrome浏览器,添加此代码,不过我这测试没用,依然警告:Scripts may close only the windows that were opened by it. window.close(); } } </script> </head> <body> </body> </html>
来源:《HTML、CSS、Javascript网页制作从入门到精通》15.3章节
PS:IE下有效