如何利用網(wǎng)頁彈出各種形式的窗口,我想大家大多都是知道些的,但那種多種多樣的彈出式窗口是怎么搞出來的,我們今天就來學習一下:
1.彈啟一個全屏窗口
- <html>
- <body onload="window.open('http://www.pconline.com.cn','example01','fullscreen');">;
- <b>www.e3i5.com</b>
- </body>
- </html>
<html><body onload="window.open('http://www.pconline.com.cn','example01','fullscreen');">;<b>www.e3i5.com</b></body></html>
2.彈啟一個被F11化后的窗口
- <html>
- <body onload="window.open(''http://www.pconline.com.cn','example02','channelmode');">;
- <b>www.e3i5.com</b>
- </body>
- </html>
<html><body onload="window.open(''http://www.pconline.com.cn','example02','channelmode');">;<b>www.e3i5.com</b></body></html>
3.彈啟一個帶有收藏鏈接工具欄的窗口
- <html>
- <body onload="window.open('http://www.pconline.com.cn','example03','width=400,height=300,directories');">
- <b>www.e3i5.com</b>
- </body>
- </html>
<html><body onload="window.open('http://www.pconline.com.cn','example03','width=400,height=300,directories');"><b>www.e3i5.com</b></body></html>
4.網(wǎng)頁對話框
- <html>
- <SCRIPT LANGUAGE="javascript">
- <!--
- showModalDialog('http://www.pconline.com.cn','example04','dialogWidth:400px;dialogHeight:300px;
- dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes')
- //-->
- </SCRIPT>
- <b>www.e3i5.com</b>
- </body>
- </html>
<html><SCRIPT LANGUAGE="javascript"><!--showModalDialog('http://www.pconline.com.cn','example04','dialogWidth:400px;dialogHeight:300px;dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes')//--></SCRIPT><b>www.e3i5.com</b></body></html>
showModalDialog()或是showModelessDialog() 來調用網(wǎng)頁對話框,至于showModalDialog()與showModelessDialog()的區(qū)別,在于showModalDialog() 打開的窗口(簡稱模式窗口),置在父窗口上,必須關閉才能訪問父窗口(建議盡量少用,以免招人反感);showModelessDialog()(簡稱無模式窗口),打開后不必關閉也可訪問父窗口打開的窗口。
dialogHeight: iHeight 設置對話框窗口的高度。
dialogWidth: iWidth 設置對話框窗口的寬度。
dialogLeft: iXPos 設置對話框窗口相對于桌面左上角的left位置。
dialogTop: iYPos 設置對話框窗口相對于桌面左上角的top位置。
center: {yes | no | 1 | 0 } 指定是否將對話框在桌面上居中,默認值是“yes”。
help: {yes | no | 1 | 0 } 指定對話框窗口中是否顯示上下文敏感的幫助圖標。默認值是“yes”。
resizable: {yes | no | 1 | 0 } 指定是否對話框窗口大小可變。默認值是“no”。
status: {yes | no | 1 | 0 } 指定對話框窗口是否顯示狀態(tài)欄。對于非模式對話框窗口,默認值是“yes”;對于模式對話框窗口,默認值是 “no”。