showModalDialog弹出窗口,返回内容至父窗体

showModalDialog弹出窗口,返回内容至父窗体

IE6,7,8,9 FF下测试没有问题


父窗体
<script type="text/javascript">
	function openSelector(url,iWidth,iHeight){ 
	    var iTop = 0;
        var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
		window.showModalDialog(url,window,"dialogWidth:"+iWidth+"px;dialogHeight:"+iHeight+"px;dialogTop:"+iTop+"px;dialogLeft:"+iLeft+"px;edge: Raised; center: Yes; help: No; resizable: Yes; status: No;");	
	}
</script>

<body>
<form id="form1" name="form1">
<input name="test" id="test" type="text" value="" />
<a href="javascript:void(0)" onclick="openSelector('1.html',500,300);">子窗体</a>
</form>
</body>





子窗体
<script type="text/javascript">
var parent_window = window.parent.dialogArguments.document;
parent_window.form1.test.value = "123";
</script>





你可能感兴趣的:(showModalDialog)