【温故而知新-Javascript】窗口效果 (全屏显示窗口、定时关闭窗口)
生活随笔
收集整理的這篇文章主要介紹了
【温故而知新-Javascript】窗口效果 (全屏显示窗口、定时关闭窗口)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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下有效
總結
以上是生活随笔為你收集整理的【温故而知新-Javascript】窗口效果 (全屏显示窗口、定时关闭窗口)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Nginx学习之七:通过Nginx社区进
- 下一篇: 使用linux 的wget下载国外的域名