window.open和window.showModalDialog页面传值

页面1javascript
<script type="text/javascript">
function createmsg()
{
var url = "${pageContext.request.contextPath}/msg.do";
//var url = "${pageContext.request.contextPath}/web/manager/playergame/gamerRole.do?gameId="+gameId+"&actorId="+actorId;
        window.open(url,"游戏信息","height=600, width=800,top=300,left=300,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
        //window.showModalDialog(url,"留言信息","dialogHeight: 250px; dialogWidth: 300px; dialogTop: 250px; dialogLeft: 300px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");

}
</script>

页面2javascript
<script type="text/javascript">
function closepage()
{
document.form1.action="${pageContext.request.contextPath}/web/manager/createMsgAction.do";
document.form1.submit();
window.close();
window.opener.history.go(0);
}
</script>


-----------------------------------------------------------------

<!--将弹出来的子窗口的值传给父窗体  
父窗口  
 
--> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
<HEAD> 
  <TITLE> New Document </TITLE> 
    
    <script type="text/javascript"> 
          
        function openWindow() {  
            var result  = window.showModalDialog("childen.html","DialogHeigth=40,DialogWidth:100px,location:no,menubar:no,toolbar:no,status:no");  
              
            if(result)  
                document.getElementsByName("content")[0].value=result;  
        }  
 
    </script> 
 
</HEAD> 
 
<BODY> 
    <input type="button" value="打开新窗口" onclick="openWindow()"> 
    <hr> 
    这是父窗口<br> 
    <input type="text" name="content" > 
</BODY> 
</HTML> 



<!--子窗口--> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
<HEAD> 
  <TITLE> New Document </TITLE> 
    
    <script type="text/javascript"> 
        function execute() {  
            window.returnValue = document.getElementsByName("content")[0].value;  
            window.close();  
        }  
    </script> 
</HEAD> 
 
<BODY> 
    <input type="text" name="content" value="这是子窗口"> 
    <input type="button" value="确定" onclick="execute()"> 
</BODY> 
</HTML> 

你可能感兴趣的:(html,游戏,Web,Go)