一个外部表单form1,里面包含一个iframe,iframe里有一个内部表单form2,我想实现form2表单提交的时候把form2表单隐藏域里面的值得传到form1的text1里面,我用的方法是在form1里定义:
A.jsp如下:
<script language="JavaScript">
<!--
function AA(){
document.form1.swbh.value=document.frames("flowframe").form2.swbh.value;
}
-->
</script>
<form name="form1" method="post">
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td align="center" nowrap bgcolor="#ECFAFF"><div align="right">流 水 号: </div>
<input type="text" name="swbh" maxlength="40" class="BigInput" onclick="javascript:AA();"> <font color="#FF0000">*</font></td>
</tr>
<tr bgcolor="#CEF1FF">
<td colspan = "4">
<Iframe src="B.jsp?type=1" width="100%" scrolling="Auto" frameborder="0" name="flowframe" id="flowframe" onload="this.height=flowframe.document.body.scrollHeight"></iframe>
</td>
</tr>
</table>
</form>
B.jsp如下:
<%
String lcid = StringUtil.parameterTrim(ParamUtil.getParameter(request,"lcid",true));
System.out.println("lcid是多少:::"+lcid);
String lsh="";
SwManage swManage = new SwManage();
if(!(lcid==null||lcid.equals(""))){
lsh = swManage.getNextLsh(lcid);
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<form name="form2" method="post" action="sw_workflow.jsp?type=<%=type%>&fwlx=<%=strFwlx%>">
<input type="hidden" name="swbh" value="<%=lsh%>">
<tr>
<td width="20%" align="right" bgcolor="#ECFAFF">请选择流程:</td>
<td><select name="lcid" onChange="javascript:document.form2.submit();">
<option value="-1" selected>请选择</option>
<%if(listflow!=null){
for(int i=0;i<listflow.length;i++){
if(lcid.compareTo(listflow[i][0])==0){
%>
<option value="<%=StringUtil.trim(listflow[i][0])%>"selected><%=StringUtil.trim(listflow[i][1])%></option>
<%}else{%>
<option value="<%=StringUtil.trim(listflow[i][0])%>"><%=StringUtil.trim(listflow[i][1])%></option>
<%}}}%>
</select>
</td>
</tr>
</form>
</table>
但是能不能实现form2提交的时候form1自动接收那个值并显示在text1里面,而且不刷新页面,请教各位了.
[此贴子已经被作者于2007-9-10 14:54:04编辑过]