可以把值直接传给主页面的hidden域里:
在主窗口中加:
<input type="hidden" name="retValue" value="">
在打开的页面关闭之前给主页面的retValue赋值:
self.opener.retValue.value = document.form1.dealrequest.value;这样可以吗。
在主窗口中加:
<input type="hidden" name="retValue" value="">
在打开的页面关闭之前给主页面的retValue赋值:
self.opener.retValue.value = document.form1.dealrequest.value;这样可以吗。
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function Minimize()
{
var b= window.showModalDialog("windows1.htm","dialogwin",
"scroll:0;status:0;help:0;resizable:0;dialogWidth:280px;dialogHeight:300px")
for(i=0;i<b.length;i++) alert(b[i])
//document.form1.retValue.value=b;//************取回返回值************
} </SCRIPT>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>超链接按钮传值</title>
</HEAD>
<body>
<form name="form1" method="post">
<input type="text" name="retValue" value="">
<a href="JavaScript:onClick=Minimize()">Minimize</a> </form>
</body>
</html>
windows1.htm
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>用户管理的数据处理</title>
</HEAD><script language="JavaScript">
function sendTo()
{
var a,c;
a=document.form1.申请号.value;
c="fuck you!!!!!!!!!!!";
var b=new Array(a,c)
window.returnValue =b;
window.close(); }
function sendTo1()
{ window.returnValue ="取消";
window.close(); }
function focus()
{
document.form1.申请号.focus();//************聚焦**********
}
</script>
<body onfocus="focus()" ><form name="form1" method="post" >
<p align="center">
<table width="258" height="282" border="1" >
<tr align="center">
<td colspan="2">申请号:
<input type="text" name="申请号" value="I love you forever!" disabled="true"> </td>
</tr>
<tr align="center">
<td colspan="2">合同号:
<input type="text" name="合同号"></td>
</tr>
<tr align="center">
<td height="72" colspan="2">供应商:
<input type="text" name="供应商"></td>
</tr>
<tr>
<td width="121" align="center">
<input value="提 交" type=button onclick="sendTo()"></td>
<td width="121" align="center">
<input value="取 消" type=button onclick="sendTo1()"></td>
</tr>
</table></form>
</body>
</html>