关于ASP中iframe的问题
我在A中包含了B,想在A中得到B中表单的数据,但结果出错AA.HTM<html><head><metahttp-equiv="Content-Type"content="...
我在A中包含了B,想在A中得到B中表单的数据,但结果出错
AA.HTM
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>如何获取iframe中表单的值</title>
</head>
<body>
<form name="form1" method="post" action="">
<p>如何获取iframe中表单的值:</p>
<p> 这里显示iframe调用页面的表单值:
<input type="text" name="xianshi">
</p>
<p>这里是iframe页面。<iframe scrolling="no" frameborder="0" src="bb.htm" height="34" width="200"></iframe></p>
</form>
</body>
</html>
BB.HTM
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>iframe页面</title>
</head>
<script language="javascript">
function gaibian1()
{
parent.document.form1.xianshi.value=document.form2.uaa.value;
}
</script>
<body>
<form name="form2" method="post" action="">
<input name="uaa" type="radio" value="1"onclick="javascript:gaibian1();">111<input name="uaa" type="radio" value="2" onclick="javascript:gaibian1();">222
</form>
</body>
</html>
但结果就是不能显示正确的,表单值的显示框里一直是undefined,帮我啊 展开
AA.HTM
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>如何获取iframe中表单的值</title>
</head>
<body>
<form name="form1" method="post" action="">
<p>如何获取iframe中表单的值:</p>
<p> 这里显示iframe调用页面的表单值:
<input type="text" name="xianshi">
</p>
<p>这里是iframe页面。<iframe scrolling="no" frameborder="0" src="bb.htm" height="34" width="200"></iframe></p>
</form>
</body>
</html>
BB.HTM
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>iframe页面</title>
</head>
<script language="javascript">
function gaibian1()
{
parent.document.form1.xianshi.value=document.form2.uaa.value;
}
</script>
<body>
<form name="form2" method="post" action="">
<input name="uaa" type="radio" value="1"onclick="javascript:gaibian1();">111<input name="uaa" type="radio" value="2" onclick="javascript:gaibian1();">222
</form>
</body>
</html>
但结果就是不能显示正确的,表单值的显示框里一直是undefined,帮我啊 展开
1个回答
展开全部
bb.htm改成
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>iframe页面</title>
</head>
<script language="javascript">
function gaibian1(v)
{
parent.document.form1.xianshi.value=v;
}
</script>
<body>
<form name="form2" method="post" action="">
<input name="uaa" type="radio" value="1"onclick="javascript:gaibian1(this.value);">111<input name="uaa" type="radio" value="2" onclick="javascript:gaibian1(this.value);">222
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>iframe页面</title>
</head>
<script language="javascript">
function gaibian1(v)
{
parent.document.form1.xianshi.value=v;
}
</script>
<body>
<form name="form2" method="post" action="">
<input name="uaa" type="radio" value="1"onclick="javascript:gaibian1(this.value);">111<input name="uaa" type="radio" value="2" onclick="javascript:gaibian1(this.value);">222
</form>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询