iframe提交 kiss0931:办法不错? 在请教一个问题,如何将iframe(b.htm)里的元素加入他的父窗体(a.htm),谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 a.jsp: <input name="userName"> <iframe src="b.jsp"></iframe>-------------------b.jsp (JavaScript codes): parent.document.all.userName.value = "中国教育改革=失败"; 这个很简单了,你可以层层取出你要的参数传就可以了,如:你的父窗是frame[0],子窗是frame[1],你可以这样写求子窗的参数,frame[0].frame[1]。××× 请指教a.htm<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title></head><script> function a(obj) { alert(obj.value); } function add() { for(i=0;i<window.document.frames["iframe1"].form2.length;i++) { //alert(window.document.frames["iframe1"].form2.elements(i)); //这里总是报错,说我的参数不对,请问怎样解决? form1.appendChild(window.document.frames["iframe1"].form2.elements(i)); } }</script><body><form id="form1" name="form1" action="a.htm"><table> <tr> <td><input id="info" name="info"></td> </tr> <tr> <td> <iframe id="iframe1" name="iframe1" src="b.htm"></iframe> </td> </tr> <tr> <td> <input type="button" onClick="add()" value="add"> </td> </tr></table></form></body></html>b.htm<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title></head><script language="javascript">function addFile(m) { var a=tablename.insertRow(tablename.rows.length); cell=a.insertCell(0); cell.innerHTML="<input type=file id=scaninfo name=scaninfo style='width:100%'>"; cell=a.insertCell(1); cell.innerHTML="<input type=button name=button1 value='删除扫描件' onclick='delRow()'>"; }function delRow(){ tablename.deleteRow(event.srcElement.parentElement.parentElement.rowIndex);}</script><body topmargin="0" rightmargin="0" leftmargin="0" bottommargin="0"><form id="form2" name="form2" method="post" action="a.htm"><table width="100%" class=sort-table id=tablename name=tablename cellSpacing=0> <tr> <td> <input id="scaninfo" name="scaninfo" type="file" style="width:100%" onpropertychange="add()";> </td> <td> <input type="button" name="button1" onClick="addFile(0)" value="添加扫描件"> </td> </tr></table></form></body></html> 为什么连接数据库驱动会报错 老问题:关于EJB与JAVABEAN 请问如何识别客户端是通过代理上来的? 请帮忙看一下自定义的switch case 标签库,没有显示值? 又有新的问题了,帮忙! 为何在API文档中查不到com.jspsmart.upload 这些东东? 为啥我jsp中显示数据库中的记录总是乱码?????在线等待立即加分 如何用JSP实现树形视图? weblogic+oracle部分汉字问题 netty+websocket报错 ArrayList的循环问题 请问怎么在java中调用.net的webservice
<input name="userName">
<iframe src="b.jsp"></iframe>-------------------
b.jsp (JavaScript codes):
parent.document.all.userName.value = "中国教育改革=失败";
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script>
function a(obj)
{
alert(obj.value);
}
function add()
{
for(i=0;i<window.document.frames["iframe1"].form2.length;i++)
{
//alert(window.document.frames["iframe1"].form2.elements(i));
//这里总是报错,说我的参数不对,请问怎样解决?
form1.appendChild(window.document.frames["iframe1"].form2.elements(i));
}
}
</script>
<body>
<form id="form1" name="form1" action="a.htm">
<table>
<tr>
<td><input id="info" name="info"></td>
</tr>
<tr>
<td>
<iframe id="iframe1" name="iframe1" src="b.htm"></iframe>
</td>
</tr>
<tr>
<td>
<input type="button" onClick="add()" value="add">
</td>
</tr>
</table>
</form>
</body>
</html>b.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="javascript">
function addFile(m)
{
var a=tablename.insertRow(tablename.rows.length);
cell=a.insertCell(0);
cell.innerHTML="<input type=file id=scaninfo name=scaninfo style='width:100%'>";
cell=a.insertCell(1);
cell.innerHTML="<input type=button name=button1 value='删除扫描件' onclick='delRow()'>";
}
function delRow()
{
tablename.deleteRow(event.srcElement.parentElement.parentElement.rowIndex);
}
</script>
<body topmargin="0" rightmargin="0" leftmargin="0" bottommargin="0">
<form id="form2" name="form2" method="post" action="a.htm">
<table width="100%" class=sort-table id=tablename name=tablename cellSpacing=0>
<tr>
<td>
<input id="scaninfo" name="scaninfo" type="file" style="width:100%" onpropertychange="add()";>
</td>
<td>
<input type="button" name="button1" onClick="addFile(0)" value="添加扫描件">
</td>
</tr>
</table>
</form>
</body>
</html>