window.showModalDialog() 使用方法:
var returnValue = window.showModalDialog(url [, arguments] [,features]);
url -- 必選參數,類型:字符串,用來指定對話框要顯示的文檔的URL
arguments -- 可選參數,類型:變體,用來向對話框傳遞參數,傳遞的參數類型不限,包括數組等,對話框通過window.dialogArguments來取得傳遞進來的參數
features -- 可選參數,類型:字符串,用來描述對話框的外觀等信息,可以使用以下的一個或幾個,用分號“;”隔開
dialogHeight:對話框高度,不小于100px
dialogWidth:對話框寬度
dialogLeft:離屏幕左的距離
dialogTop:離屏幕上的距離
center:{ yes | no | 1 | 0 }:是否居中,默認yes,但仍可以指定高度和寬度
help:{yes | no | 1 | 0 }:是否顯示幫助按鈕,默認yes
resizable:{yes | no | 1 | 0 } [IE5+]:是否可被改變大小,默認no
status:{yes | no | 1 | 0 } [IE5+]:是否顯示狀態欄,默認為yes[ Modeless]或no[Modal]
scroll:{ yes | no | 1 | 0 | on | off }:是否顯示滾動條,默認為yes
參數傳遞:
1. 要想對話框傳遞參數,是通過arguments來進行傳遞的,類型不限制,對于字符串類型,最大為4096個字符,也可以傳遞對象,例如:
parent.htm
var obj = new Object();
obj.name="justflyhigh.com";
window.showModalDialog("modal.htm",obj,"dialogWidth=200px;dialogHeight=100px");
</script>
parent.htm
新聞熱點
疑難解答