窗体之间传值

帮一朋友:
其实就是解决怎么在子窗体得到父窗体句柄,那样关闭子窗体就可以把值传递回去。

父:
    
<script type="text/javascript">
         
function cd()
         
{ win=window.open("son.htm","win","width=200,height=200");}
         
         
function son(name)
         
{ document.getElementById("name").value = name; }
     
</script>
        
<input type="button"  value="子页面" onclick="cd();">
        
<input type="text" id="name" name="">
子son.htm:
    
<script type="text/javascript">
     
function reflesh()
     
{
         
var parentPage = window.opener;
         window.opener 
= null;
         parentPage.son(document.getElementById(
"name").value);
         
//window.opener.location.reload();  //实现父窗体刷新 
     }

</script>
<input type="button" value="刷新" onclick="reflesh();">
<input type="text" id="name" value="刷新">

posted @ 2007-11-01 17:21  ant520  阅读(179)  评论(0编辑  收藏  举报