js showModalDialog弹出窗口实例详解
showModalDialog:模式窗口,一种很特别的窗口,当它打开时,后面的父窗口的活动会停止,除非当前的模式子窗口关闭了,才能操作父窗口.在做网页Ajax开发时,我们应该有时会用到它来实现表单的填写,或做类似网上答题的窗口. 它的特点是,传参很方便也很强大,可直接调用父窗口的变量和方法. 使用方法: 参数说明: vArguments-- sFeatures-- 1.dialogHeight : 2.dialogWidth: 3.dialogLeft: 4.dialogTop: 5.center: {yes | no | 1 | 0 }: 6.help: {yes | no | 1 | 0 }: 7.resizable: {yes | no | 1 | 0 } 8.status: {yes | no | 1 | 0 } 9.scroll:{ yes | no | 1 | 0 | on | off }: 10.dialogHide:{ yes | no | 1 | 0 | on | off }: 11.edge:{ sunken | raised }: 12.unadorned:{ yes | no | 1 | 0 | on | off }: FOR example: 复制代码 代码如下: <script> function setname(res){ document.getElementByIdx_x("name").value=res; } function selectTp(){ //把父窗口的setname函数传给子窗口window.showModalDialog('child.html',setname,'dialogWitdh:300px;dialogHeight:300px;center:yes;'); } </script> <input type="button" value="提交" onclick="selectTp()"/> <input type="text" id="name" name='name'/> child.html <SCRIPT LANGUAGE="JavaScript"> this.close(); } //--> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |