新建父窗口页面:
加入以下脚本
立即学习“Java免费学习笔记(深入)”;
http://www.w3.org/1999/xhtml" >
<script type="text/<a style=" color: text-decoration:underline title="javascript" href="https://www.php.cn/zt/15724.html" target="_blank">javascript"><br> function ShowDialog(Url) <br> { <br> var iWidth=560; //模态窗口宽度<br> var iHeight=300;//模态窗口高度<br> var iTop=(window.screen.height-iHeight-100)/2;<br> var iLeft=(window.screen.width-iWidth)/2;<br> var returnValue=window.showModalDialog(Url, "newwindow", "dialogHeight:"+iHeight+"px; dialogWidth:"+iWidth+"px; toolbar:no; menubar:no; scrollbars:no; resizable:no; location:no; status:no;left:200px;top:100px;");<br> document.getElementById("TextBox1").innerText=returnValue;<br> } <br> </script>
创建second.html页面:
立即学习“Java免费学习笔记(深入)”;
http://www.w3.org/1999/xhtml" >
<script language="javascript"><br> function closeDiag()<br> {<br> window.opener=null;<br> window.close();<br> } <br> function OK()<br> {<br> var Value=document.getElementsByName("myRadio");<br> for(var i=0;i<Value.length;i++)<br> {<br> if(Value[i].checked)<br> { <br> window.returnValue = Value[i].value;<br> window.close();<br> }<br> else<br> {<br> document.getElementById("Lab_Info").innerText="没有选中项,请选择!";<br> }<br> } <br> } <br> </script>
以上就是本人实现这个简单功能的全部内容了,感觉应该还有更便捷的方法,有知道的小伙伴还请留言说明下。











