介紹:
showModalDialog()
showModelessDialog()
window.showModalDialog() 此方法用來建立一個顯示HTML内容的模态對話框。
window.showModelessDialog() 此方法用來建立一個顯示HTML内容的非模态對話框。
使用方法:
vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])
vReturnValue = window.showModelessDialog(sURL [, vArguments] [,sFeatures])
參數說明:
sURL -- 必選參數,類型:字元串。用來指定對話框要顯示的文檔的URL。
vArguments -- 可選參數,類型:變體。用來向對話框傳遞參數。傳遞的參數類型不限,包括數組等。對話框通過window.dialogArguments來取得傳遞進來的參數。
sFeatures -- 可選參數,類型:字元串。用來描述對話框的外觀等資訊,可以使用以下的一個或幾個,用分号“;”隔開。
----------------
1. dialogHeight: 對話框高度,不小于100px
2. dialogWidth: 對話框寬度。
3. dialogLeft: 離螢幕左的距離。
4. dialogTop: 離螢幕上的距離。
5. center: { yes | no | 1 | 0 } : 是否居中,預設yes,但仍可以指定高度和寬度。
6. help: {yes | no | 1 | 0 }: 是否顯示幫助按鈕,預設yes。
7. resizable: {yes | no | 1 | 0 } [IE5+]: 是否可被改變大小。預設no。
8. status:{yes | no | 1 | 0 } [IE5+]:是否顯示狀态欄。預設為yes[ Modeless]或no[Modal]。
9. scroll:{ yes | no | 1 | 0 | on | off }:是否顯示滾動條。預設為yes。
下面幾個屬性是用在HTA中的,在一般的網頁中一般不使用。
10. dialogHide:{ yes | no | 1 | 0 | on | off }:在列印或者列印預覽時對話框是否隐藏。預設為no。
11. edge:{ sunken | raised }:指明對話框的邊框樣式。預設為raised。
12. unadorned:{ yes | no | 1 | 0 | on | off }:預設為no。
參數傳遞:
1.要想對話框傳遞參數,是通過vArguments來進行傳遞的。類型不限制,對于字元串類型,最大為4096個字元。也可以傳遞對象。