for(i=0;i<=49;i++){
eval("document.formtest.gdchw_zh"+i+".value")=eval("top.document.zhuanhuan.gdchw"+i+".value")
}//这样
eval("document.formtest.gdchw_zh"+i+".value")=eval("top.document.zhuanhuan.gdchw"+i+".value")
}//这样
解决方案 »
- 急急急!!!JS获取用户名
- 很有趣的JS的问题
- xml的解析问题
- 加载xml 对象出错+++++++++++++++++++++++++++++++++++++十万火急 全部积分了
- 双击一行如何得到这一行的第一列和第三列的值?
- 急,关于获取Flash文件宽高的问题
- 如何獲取頁面中所有DIV的ID?
- 调用window.close()的问题
- 求象marquee一样从右到左的源码,可以设开始的位置
- window.opener.location.reload();怎样才能不弹出“重试”“取消”对话框??
- 我想做到单击下拉框中的选项,使文本框内容相应做出改变,没实现!谁能帮我?(可将我问题中的代码直接存成.htm文件调试,在线等候!) 2
- 如何才能真正实现“进度条”程序?寻求正解,急啊~~
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
<script language="javascript">
<!--
function chuanzhi()
{
document.formtest.mbch_zh.value=top.document.zhuanhuan.mbch.value;
document.formtest.gdsl_zh.value=top.document.zhuanhuan.gdsl.value;for(i=0;i<eval(document.formtest.gdsl_zh.value);i++)
{
eval("document.formtest.gdchw_zh"+i+".value")=eval("top.document.zhuanhuan.gdchw"+i+".value");
}
}
-->
</script></head><body onLoad="javascript:chuanzhi();">
<form name="formtest" method="post" action="test.asp">
<input type="text" name="mbch_zh" id="mbch_zh" value="">
<input type="text" name="gdsl_zh" id="gdsl_zh" value=""><br><br><input type="text" name="gdchw_zh0" id="gdchw_zh0" value=""><br>
<input type="text" name="gdchw_zh1" id="gdchw_zh1" value=""><br>
<input type="text" name="gdchw_zh2" id="gdchw_zh2" value=""><br>
<input type="text" name="gdchw_zh3" id="gdchw_zh3" value=""><br>
<input type="text" name="gdchw_zh4" id="gdchw_zh4" value=""><br>
<input type="text" name="gdchw_zh5" id="gdchw_zh5" value=""><br>
<input type="text" name="gdchw_zh6" id="gdchw_zh6" value=""><br>
<input type="text" name="gdchw_zh7" id="gdchw_zh7" value=""><br>
<input type="text" name="gdchw_zh8" id="gdchw_zh8" value=""><br>
<input type="text" name="gdchw_zh9" id="gdchw_zh9" value=""><br>
<input type="text" name="gdchw_zh10" id="gdchw_zh10" value=""><br>
<input type="text" name="gdchw_zh11" id="gdchw_zh11" value=""><br>
<input type="text" name="gdchw_zh12" id="gdchw_zh12" value=""><br>
</form>
</body>
</html>麻烦帮我看看,为什么我还是得不到数据呢??document.formtest.mbch_zh.value=top.document.zhuanhuan.mbch.value;
document.formtest.gdsl_zh.value=top.document.zhuanhuan.gdsl.value;可以得到数据,其它的还是不行哦,麻烦帮我看看啊,谢谢了!!!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
<script language="javascript">
<!--
function chuanzhi()
{
document.formtest.mbch_zh.value=top.document.zhuanhuan.mbch.value;
document.formtest.gdsl_zh.value=top.document.zhuanhuan.gdsl.value;for(i=0;i<parseInt(document.formtest.gdsl_zh.value);i++)
{
eval("document.formtest.gdchw_zh"+i+".value")=eval("top.document.zhuanhuan.gdchw"+i+".value");
}
}
-->
</script></head><body onLoad="javascript:chuanzhi();">
<form name="formtest" method="post" action="test.asp">
<input type="text" name="mbch_zh" id="mbch_zh" value="">
<input type="text" name="gdsl_zh" id="gdsl_zh" value=""><br><br><input type="text" name="gdchw_zh0" id="gdchw_zh0" value=""><br>
<input type="text" name="gdchw_zh1" id="gdchw_zh1" value=""><br>
<input type="text" name="gdchw_zh2" id="gdchw_zh2" value=""><br>
<input type="text" name="gdchw_zh3" id="gdchw_zh3" value=""><br>
<input type="text" name="gdchw_zh4" id="gdchw_zh4" value=""><br>
<input type="text" name="gdchw_zh5" id="gdchw_zh5" value=""><br>
<input type="text" name="gdchw_zh6" id="gdchw_zh6" value=""><br>
<input type="text" name="gdchw_zh7" id="gdchw_zh7" value=""><br>
<input type="text" name="gdchw_zh8" id="gdchw_zh8" value=""><br>
<input type="text" name="gdchw_zh9" id="gdchw_zh9" value=""><br>
<input type="text" name="gdchw_zh10" id="gdchw_zh10" value=""><br>
<input type="text" name="gdchw_zh11" id="gdchw_zh11" value=""><br>
<input type="text" name="gdchw_zh12" id="gdchw_zh12" value=""><br>
</form>
</body>
</html>
这个页面是一个内嵌的框架页面,准备从主框架中获取数据,数据的数量有四种可能10,20,30,50我想跟着主框架参数的变化,我要在当前框架中显示相同数量的文本框和隐藏域两种控件(以备后面的数据提交),请教有什么好的方法么??谢谢了
麻烦帮我看看,为什么我得不到数据呢??
document.formtest.mbch_zh.value=top.document.zhuanhuan.mbch.value;
document.formtest.gdsl_zh.value=top.document.zhuanhuan.gdsl.value;可以得到数据,其它的还是不行哦,麻烦帮我看看啊,谢谢了!!!
<input name="mbch" type="hidden" value="<%=request.Form("mubiao")%>">
<input name="gdsl" type="hidden" value="<%=request.Form("gdsm")%>">
<% for i=0 to (request.Form("gdsm")-1) %><input name="gdchw<%=i%>" type="hidden" value="<%=request.Form("h_word"&i)%>"><% next %>
</form>
<table width="437" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="20"> </td>
<td align="left">词汇测试 >><%=ss%><%=tt%></td>
</tr>
<tr>
<td colspan="2">
<iframe id="frmceshi" width="430" height="300" scrolling="yes" frameborder="1" style="" src="test.asp"></iframe>
</td>
</tr>
</table>主框架代码太多了,我只贴了一部分相关的代码,这部分经过测试了,是没有问题的,数据输出都是正确的。原本考虑从主框架传到内嵌的框架,但是几乎行不通哦,主框架的语句太多了;只有考虑从内嵌框架接收数据了,谢谢帮忙啊!!
<body onLoad="javascript:chuanzhi();">
这样top获得的全是""
点击form再把值传给top吧
<form name="formtest" method="post" action="test.asp" onSubmit="chuanzhi();">
<input name="mbch" type="hidden" value="<%=request.Form("mubiao")%>">
<input name="gdsl" type="hidden" value="<%=request.Form("gdsm")%>">
<% for i=0 to (request.Form("gdsm")-1) %><input name="gdchw<%=i%>" type="hidden" value="<%=request.Form("h_word"&i)%>"><% next %>request.Form("h_word"&i)根本有用
原来你是想从主框架中获取数据.以为你把iframe 的数据传给主框架;<input name="gdchw<%=i%>" type="hidden" value="<%=request.Form("h_word"&i)%>">
你必须保证有值
document.formtest.mbch_zh.value=top.document.zhuanhuan.mbch.value;
document.formtest.gdsl_zh.value=top.document.zhuanhuan.gdsl.value;<input type="text" name="mbch_zh" id="mbch_zh" value="">
<input type="text" name="gdsl_zh" id="gdsl_zh" value="">这个是通过的啊,能得到值的。很奇怪哦还有,我把
hidden改为text后,能得到数据的,说明 request.Form("h_word"&i) 是可行的哦!
<input name="gdchw<%=i%>" type="hidden" value="<%=request.Form("h_word"&i)%>">最后,
我还是不知道如何循环获得
文本框输出哦,
能直接调用内嵌框架内的子程序么???
index.htm
_________________________________
<form name="form1" method="post" action="index.asp">
<p>
<input type="text" name="mubiao">
<br>
<input type="text" name="gdsm">
<br>
<input type="text" name="h_word0">
<br>
<input type="text" name="h_word1">
<br>
<input type="text" name="h_word2">
<br>
<input type="text" name="h_word3">
<br>
<input type="text" name="h_word4">
<br>
<input type="text" name="h_word5">
</p>
<p>
<input type="submit" name="Submit" value="提交">
<br>
</p>
</form>____________________________________________________________index.asp__________________________________________________________<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><form action="" method="post" name="zhuanhuan">
<input name="mbch" value="<%=request.Form("mubiao")%>">
<input name="gdsl" value=<%=request.Form("gdsm")%>>
<% for i=0 to (request.Form("gdsm")-1) %><input name="gdchw<%=i%>" value="<%=request.Form("h_word"&i)%>"><% next %>
</form>
<table width="437" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="20"> </td>
<td align="left">词汇测试 >><%=ss%><%=tt%></td>
</tr>
<tr>
<td colspan="2">
<iframe id="frmceshi" width="430" height="300" scrolling="yes" frameborder="1" style="" src="test.asp"></iframe>
</td>
</tr>
</table>
_________________________________________________________________________________________
test.asp
_______________________________________________________________________________________<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
<script language="javascript">
<!--
function chuanzhi()
{
document.formtest.mbch_zh.value=top.document.zhuanhuan.mbch.value;
document.formtest.gdsl_zh.value=top.document.zhuanhuan.gdsl.value;
var i;
for(i=0;i<parseInt(document.formtest.gdsl_zh.value);i++)
{
eval("document.formtest.gdchw_zh"+i+".value=top.document.zhuanhuan.gdchw"+i+".value");
}
}
-->
</script></head><body onLoad="javascript:chuanzhi()">
<form name="formtest" method="post" >
<input type="text" name="mbch_zh" id="mbch_zh" value="">
<input type="text" name="gdsl_zh" id="gdsl_zh" value=""><br><br><input type="text" name="gdchw_zh0" id="gdchw_zh0" value=""><br>
<input type="text" name="gdchw_zh1" id="gdchw_zh1" value=""><br>
<input type="text" name="gdchw_zh2" id="gdchw_zh2" value=""><br>
<input type="text" name="gdchw_zh3" id="gdchw_zh3" value=""><br>
<input type="text" name="gdchw_zh4" id="gdchw_zh4" value=""><br>
<input type="text" name="gdchw_zh5" id="gdchw_zh5" value=""><br>
<input type="text" name="gdchw_zh6" id="gdchw_zh6" value=""><br>
<input type="text" name="gdchw_zh7" id="gdchw_zh7" value=""><br>
<input type="text" name="gdchw_zh8" id="gdchw_zh8" value=""><br>
<input type="text" name="gdchw_zh9" id="gdchw_zh9" value=""><br>
<input type="text" name="gdchw_zh10" id="gdchw_zh10" value=""><br>
<input type="text" name="gdchw_zh11" id="gdchw_zh11" value=""><br>
<input type="text" name="gdchw_zh12" id="gdchw_zh12" value=""><br>
</form>
</body>
</html>
给你的:eval("document.formtest.gdchw_zh"+i+".value")=eval("top.document.zhuanhuan.gdchw"+i+".value")是错误的!!!!!
因为是不能给函数负值的.eval("document.formtest.gdchw_zh"+i+".value=top.document.zhuanhuan.gdchw"+i+".value")才对.唉,什么是时候都是眼大睇过龙了.
我都说看错了.
____________________________________
能直接调用内嵌框架内的子程序么???
_____________________________________可以!还有贴代码出来,若有2页以上,都应该说明哪个是什么文件,哪个是什么文件的.方便别人看/理解你的意图
谢谢你的帮忙了,搞定了,谢谢了!!还有哦,我想同样把<input type="text" name="gdchw_zh0" id="gdchw_zh0" value=""><br>
<input type="text" name="gdchw_zh1" id="gdchw_zh1" value=""><br>
<input type="text" name="gdchw_zh2" id="gdchw_zh2" value=""><br>
<input type="text" name="gdchw_zh3" id="gdchw_zh3" value=""><br>
<input type="text" name="gdchw_zh4" id="gdchw_zh4" value=""><br>
<input type="text" name="gdchw_zh5" id="gdchw_zh5" value=""><br>
<input type="text" name="gdchw_zh6" id="gdchw_zh6" value=""><br>
<input type="text" name="gdchw_zh7" id="gdchw_zh7" value=""><br>
<input type="text" name="gdchw_zh8" id="gdchw_zh8" value=""><br>
<input type="text" name="gdchw_zh9" id="gdchw_zh9" value=""><br>
<input type="text" name="gdchw_zh10" id="gdchw_zh10" value=""><br>
<input type="text" name="gdchw_zh11" id="gdchw_zh11" value=""><br>
<input type="text" name="gdchw_zh12" id="gdchw_zh12" value="">搞个循环,数量就是上面传入的数值 document.formtest.gdsl_zh.value ,我又不知道怎么弄哦,pansiom(pansiom):
你说的对,下次,我一定注意问问题的方式,会加注释的!
改eval("document.formtest.gdchw_zh"+i+".value=top.document.zhuanhuan.gdchw"+i+".value");
就是了.
eval("document.formtest.gdchw_zh"+i+".value=document.formtest.gdsl_zh.value");因为document.formtest.gdsl_zh.value=top.document.zhuanhuan.gdsl.value;
所以也可以eval("document.formtest.gdchw_zh"+i+".value=top.document.zhuanhuan.gdsl.value");不过这样不好,每次都得访问top.
.
.
.</form>因为我对javascript就是不太明白,劳您费大神了,呵呵,谢谢了!
<form name="formtest" method="post">
<input type="text" name="gdchw_zh0" id="gdchw_zh0" value=""><br>
<input type="text" name="gdchw_zh1" id="gdchw_zh1" value=""><br><script>
var tem=top.document.zhuanhuan.gdsl.value;
for(var i=0;i<parseInt(tem);i++)
{
WriteLine("<input type='text' name='gdchw_zh'"+i+" id='gdchw_zh'"+i+" value='"+tem+"'><br>");
}
</script>
</form>
document.write("<input type='text' name='gdchw_zh"+i+"' id='gdchw_zh"+i+"'value='"+tem+"'>单引号的位置,改了,搞定了