window.showModalDialog 範例

使用範例:
window.showModalDialog('http://xxx.xxx.xxx....','dialogHeight: 200px; dialogWidth: 200px; dialogTop: 10px; dialogLeft: 10px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;')

如果是用 showModalDialog的話,
在子視窗中要存取母視窗的函數的話,
要注意兩個地方,
1.(母視窗中)開啟視窗:

window.showModalDialog("openwin.html",self,'modal=yes,width=775,height=700,resizable=no,scrollbars=no');

在第二個參數(vArguments),改成self.

2.(子視窗中)調用母視窗的函數:

window.dialogArguments.ShowMsg(obj.value);

ShowMsg為母視窗中的函數.

而使用window.open的話,
則是要注意一個地方,
1.(子視窗中)調用母視窗的函數:

window.opener.ShowMsg(obj.value);

使用window.opener去接母視窗的物件.

這個網誌中的熱門文章

Bash判斷參數是否存在

Node.js package : forever