问题:一个新增页面,其中客户名称:【文本框】文本框旁边有个查询超链接,点击超链接进入查询页面,查询完后点击单条记录在返回新增页面中的客户名称的文本框中。新增页面中部分代码: <td width="15%" align="right"><font color="RED" size="2">*</font>抵押单位名称:</td>
<td width="35%" class="fieldname"><html:text property="pledgeDydwmc" styleClass="inputtext" onkeydown="dealEnter();"/>
<a href="/CAPledgeCusNameAction.do?action=query" target="_blank">
查询
</a>
</td>
查询页面: <td align="middle"><%=(((Integer)request.getAttribute("pageNumber")).intValue() - 1) * ((Integer)request.getSession().getAttribute("perNum")).intValue() + recordNumber.intValue()+1%></td>
<td><bean:write name="item" property="cus_cd"/></td>
<td><bean:write name="item" property="cus_name_cn"/></td>
怎么把<bean:write name="item" property="cus_name_cn"/>的值在传回新增页面的文本框中。
<td width="35%" class="fieldname"><html:text property="pledgeDydwmc" styleClass="inputtext" onkeydown="dealEnter();"/>
<a href="/CAPledgeCusNameAction.do?action=query" target="_blank">
查询
</a>
</td>
查询页面: <td align="middle"><%=(((Integer)request.getAttribute("pageNumber")).intValue() - 1) * ((Integer)request.getSession().getAttribute("perNum")).intValue() + recordNumber.intValue()+1%></td>
<td><bean:write name="item" property="cus_cd"/></td>
<td><bean:write name="item" property="cus_name_cn"/></td>
怎么把<bean:write name="item" property="cus_name_cn"/>的值在传回新增页面的文本框中。
A页面里特地target="_blank"打开一个新的页B,传回来怎么我也希望互不耽误。各位程序看下。
我昨天open里打开action处理点了按钮没反应
window.open("/CAPledgeCusNameAction.do?action=query","抵押单位名称查询","height=100,width=400,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no";)
document.forms[0].submit();
}
首先用var s=window.showModalDialog("b.html");
打开查询页面,查询页面用AJAX执行后台返回结 果,关闭这个窗口的时候执行这个方法
window.returnValue="查询结果";
self.close();
然后文本框中用S赋值
<td width="35%" class="fieldname"><html:text property="pledgeDydwmc" styleClass="inputtext" onkeydown="dealEnter();" styleId="entName" />
<a href="/CAPledgeCusNameAction.do?action=query" target="_blank">
查询
</a>
</td>
<SCRIPT language="javascript">
function test(entName)
{
window.dialogArguments.(这里要写你A页的表单).entName.value = Trim(entName);
window.close();
}
</SCRIPT>
<td align="middle"><%=(((Integer)request.getAttribute("pageNumber")).intValue() - 1) * ((Integer)request.getSession().getAttribute("perNum")).intValue() + recordNumber.intValue()+1%></td>
<td><bean:write name="item" property="cus_cd"/></td>
<td><bean:write name="item" property="cus_name_cn"/></td>
<td>
<a href="javascript:onClick=test('<bean:write name="item" property="cus_name_cn"/>')">选择</a>
</td>
function doOurTeam(){var projectId = document.getElementById("projectId").value;
var returnValuee=showModalDialog("<htmlex:cp/>//exploit.ourteam.search.do?projectId="+projectId,window,"status:false;dialogWidth:550px;dialogHeight:500px;help:no;status:no");
document.forms[0].ourTeam.value="";
document.forms[0].ourTeam.value=returnValuee;
}
</SCRIPT>B页面----你的查询页面<SCRIPT language="javascript">
function onOk(){
var selected= document.forms[0].checkbox;
var returnVal="";
for(var i=0;i<selected.length;i++){
if(selected[i].checked==true){
if(returnVal==""){
returnVal = selected[i].value;
}else{
returnVal=returnVal+" "+selected[i].value;
}
}
}
window.returnValue=returnVal;
window.close();
}</SCRIPT>B页面直接调用onOk() 方法回写A页面对应的内容!OVER!
window.showModalDialog( url, window );
然后在弹开窗口中:
window.dialogArguments 即为父窗口window对象的引用,注意第二个参数用window,这样你就把父窗口对象当做参数传递给了子窗口.
然后在子窗口中就可以通过window.dialogArguments来引用父窗口对象了.
A页面:
<tr class="sysdisplay">
<td width="15%" align="right"><font color="RED" size="2">*</font>抵押单位名称:</td>
<td width="35%" class="fieldname"><html:text property="pledgeDydwmc" styleClass="inputtext" onkeydown="dealEnter();"/>
<input type="button" value="..." onclick="ChangeCusName();">
</td>
<td width="15%" align="right"></td>
<td width="35%" class="fieldname"></td>
</tr>function ChangeCusName(){
window.open('/cAPledgeCusNameAction.do?action=query','抵押单位名称查询','height=800,width=800,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no');
document.forms[0].submit();
}B页面:
<td>
<a onclick="subm()">
<div id="idname">
<bean:write name="item" property="cus_name_cn"/>
</div>
</a>
</td>
function subm(){
window.opener.document.getElementById('pledgeDydwmc').value=document.getElementsById("idname").innerText;
window.close();
}问题:如果我的window.opener.document.getElementById('pledgeDydwmc').value=8;
这样都是对的。
应该是我获取不到bean:write name="item" property="cus_name_cn"的值
function cusm(){
alert("aaaa");
alert(document.getElementById('cus_name_cn').value);
alert(document.getElementsById("cusnamecn").innerHTML.toString());
window.opener.document.getElementById('pledgeDydwmc').value=8;
window.close();
}
只有第一条打印aaaa,后面两天既不报错也没反应,请问各位什么原因啊?
var array=new Array(1);
var returnName=window.open("B.aspx",array);
if(returnName==null)
{
return;
}
else
{
this.document.getElementById("textbox1").value=returnName[0];
}在B页面中
var array=new Array(1);
array[0]="需要返回的名称";
window.parent.returnValue=array;
window.parent.close();可以这样试试,呵呵
window.close();我的方法获取不到?
B页面:
<a href="javascript:onClick=test('<bean:write name="item" property="cus_name_cn"/>')">
<td>
<bean:write name="item" property="cus_name_cn"/>
</td>
</a>function test(entName){
window.opener.document.getElementById('pledgeDydwmc').value=entName;
window.close();
}
A页面:
<tr class="sysdisplay">
<td width="15%" align="right"><font color="RED" size="2">*</font>抵押单位名称:</td>
<td width="35%" class="fieldname"><html:text property="pledgeDydwmc" styleClass="inputtext" onkeydown="dealEnter();"/>
<input type="button" value="..." onclick="ChangeCusName();">
</td>
<td width="15%" align="right"></td>
<td width="35%" class="fieldname"></td>
</tr>function ChangeCusName(){
window.open('/cAPledgeCusNameAction.do?action=query','抵押单位名称查询','height=800,width=800,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no');
document.forms[0].submit();
}谢谢各位了,不过div的那种方式我还是没获取到
页面A:触发点击事件,事件处理时:var returnValue=window.showModalDialog("b.html");
然后,document.getElementById("文本框").innerText= returnValue;
页面B:进行正常的数据处理完,比较笨方式的Response.write("<script>window.returnvalue=" + 处理结果 + " ;window.close();</scritp>")
当前页面就有值了。
这是什么啊?struct1啊。。后面跟action干嘛啊
查询页面:
<a href="a.jsp?id=<%=‘传的值’>"></a>
显示页面:
接收=request.getParameter("id");
根据写的dao类查询语句把结果显示出来