我要循环表示呢 for i= 1 to 10 response.write "<td ><input name=bcpxh"&i&" type=text onkeyup='input_value();' size=20></td>" next<SCRIPT LANGUAGE="JavaScript"> <!-- function input_value(){ for (i=1;i<=<%=num%>;i++) { eval("document.firstform.bcpxh1" + i + ".value = this.value"); } } //--> </SCRIPT> 这样得结果是对应得框中出现了undefined这个值 请教如何解决呢
用onblur="input_value();"不行吗?
用 onchange就行了 ,不用那么复杂。
你有两个错误: 一是你在JS的input_value()函数中调用的名称错了,你定义的是bcpxh"&i&" ,而调用时多了一个l,变成了bcpxh1,这当然就不认了; 二是你应该把点击的输入框作为参数传导至input_value(),否则value值就出不来了。 以下是我改过的代码:for i= 1 to 10 response.write "<td ><input name=bcpxh"&i&" type=text onkeyup='input_value(this);' size=20></td>" next<SCRIPT LANGUAGE="JavaScript"> <!-- function input_value(obj){ for (i=1;i<=<%=num%>;i++) { eval("document.firstform.bcpxh" + i + ".value = obj.value"); } } //--> </SCRIPT>
to :kkk2kkk(kkk2kkk) 你搞错了 我得bcpxh1和bcpxh是两个不同得元素阿 我把bcpxh1,bcpch2,bcpxh3,bcpxh4.....bcpxh12的值赋给bcpxh11,bcpxh12,bpcxh13,依次赋值阿 如何实现呢
to :kkk2kkk(kkk2kkk) 你搞错了 我得bcpxh1和bcpxh是两个不同得元素阿 我把bcpxh1,bcpch2,bcpxh3,bcpxh4.....bcpxh12的值赋给bcpxh11,bcpxh12,bpcxh13,依次赋值阿 如何实现呢
Dim num num = 100 response.write "<table> for i = 1 to num response.write "<tr><td ><input name=bcpxh" & i & " type=text onkeyup='input_value(this);' size=20></td></tr>" next response.write "</table> <SCRIPT LANGUAGE="JavaScript"> <!-- function input_value(obj){ for (i=1;i<=<%=num%>;i++) { eval("document.firstform.bcpxh1" + i + ".value = obj.value"); } } //--> </SCRIPT>
罗嗦一点: --------------- Dim num num = 100 response.write "<table> for i = 1 to num response.write "<tr><td ><input name=bcpxh" & i & " type=text onkeyup='input_value();' size=20></td></tr>" next response.write "</table> <SCRIPT LANGUAGE="JavaScript"> <!-- function input_value(){ for (i=1;i<=<%=num%>;i++) { eval("document.firstform.bcpxh1" + i + ".value = document.firstform.bcpxh" + i + ".value" ) } } //--> </SCRIPT>
<form name="firstform"> <% Dim num num = 5 response.write( "<table>") for i = 1 to num response.write "<tr><td ><input name=bcpxh" & i & " type=text onkeyup='input_value("&i&");' size=20></td></tr>" response.write "<tr><td ><input name='bcpxh1" & i & "' type=text ;size=20></td></tr>" next response.write "</table>" %> </form> <SCRIPT LANGUAGE="JavaScript"> <!-- function input_value(i){ document.firstform("bcpxh1"+i).value = document.firstform("bcpxh"+i).value } --> </SCRIPT>
你是怎么初始化的? xiaoshi=小师
for i= 1 to 10 response.write "<td ><input name=bcpxh"&i&" type=text onkeyup='input_value();' size=20></td>" next<SCRIPT LANGUAGE="JavaScript"> <!-- function input_value(){ for (i=1;i<=<%=num%>;i++) { eval("document.firstform.bcpxh1" + i).value = this.value; } } //--> </SCRIPT>
<input name=a onkeypress="b.value=this.value">
<input name=b onkeypress="a.value=this.value">
</form>
for i= 1 to 10
response.write "<td ><input name=bcpxh"&i&" type=text onkeyup='input_value();' size=20></td>"
next<SCRIPT LANGUAGE="JavaScript">
<!--
function input_value(){
for (i=1;i<=<%=num%>;i++)
{
eval("document.firstform.bcpxh1" + i + ".value = this.value");
}
}
//-->
</SCRIPT>
这样得结果是对应得框中出现了undefined这个值
请教如何解决呢
一是你在JS的input_value()函数中调用的名称错了,你定义的是bcpxh"&i&" ,而调用时多了一个l,变成了bcpxh1,这当然就不认了;
二是你应该把点击的输入框作为参数传导至input_value(),否则value值就出不来了。
以下是我改过的代码:for i= 1 to 10
response.write "<td ><input name=bcpxh"&i&" type=text onkeyup='input_value(this);' size=20></td>"
next<SCRIPT LANGUAGE="JavaScript">
<!--
function input_value(obj){
for (i=1;i<=<%=num%>;i++)
{
eval("document.firstform.bcpxh" + i + ".value = obj.value");
}
}
//-->
</SCRIPT>
你搞错了
我得bcpxh1和bcpxh是两个不同得元素阿
我把bcpxh1,bcpch2,bcpxh3,bcpxh4.....bcpxh12的值赋给bcpxh11,bcpxh12,bpcxh13,依次赋值阿
如何实现呢
你搞错了
我得bcpxh1和bcpxh是两个不同得元素阿
我把bcpxh1,bcpch2,bcpxh3,bcpxh4.....bcpxh12的值赋给bcpxh11,bcpxh12,bpcxh13,依次赋值阿
如何实现呢
num = 100
response.write "<table>
for i = 1 to num
response.write "<tr><td ><input name=bcpxh" & i & " type=text onkeyup='input_value(this);' size=20></td></tr>"
next
response.write "</table>
<SCRIPT LANGUAGE="JavaScript">
<!--
function input_value(obj){
for (i=1;i<=<%=num%>;i++)
{
eval("document.firstform.bcpxh1" + i + ".value = obj.value");
}
}
//-->
</SCRIPT>
你的这个不对,我运行的结果是开始这个页面的bcpxh1&i的值是undefined,当我在bcpxh&i输入值时,在bcpxh1&i出来的结果是所有的都是一样的值,没有达到我想要的分别赋值的效果,请教该如何解决呢
你的这个不对,我运行的结果是开始这个页面的bcpxh1&i的值是undefined,当我在bcpxh&i输入值时,在bcpxh1&i出来的结果是所有的都是一样的值,没有达到我想要的分别赋值的效果,请教该如何解决呢
---------------
Dim num
num = 100
response.write "<table>
for i = 1 to num
response.write "<tr><td ><input name=bcpxh" & i & " type=text onkeyup='input_value();' size=20></td></tr>"
next
response.write "</table>
<SCRIPT LANGUAGE="JavaScript">
<!--
function input_value(){
for (i=1;i<=<%=num%>;i++)
{
eval("document.firstform.bcpxh1" + i + ".value = document.firstform.bcpxh" + i + ".value" )
}
}
//-->
</SCRIPT>
只有这个名字最合适了
还有一个问题.就是初始化的时候,那bcpxh1&i的值为什么都是undefined阿
也就是bcpxh&i都是空值的时候,谢谢哦
<%
Dim num
num = 5
response.write( "<table>")
for i = 1 to num
response.write "<tr><td ><input name=bcpxh" & i & " type=text onkeyup='input_value("&i&");' size=20></td></tr>"
response.write "<tr><td ><input name='bcpxh1" & i & "' type=text ;size=20></td></tr>"
next
response.write "</table>"
%>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
function input_value(i){
document.firstform("bcpxh1"+i).value = document.firstform("bcpxh"+i).value
}
-->
</SCRIPT>
xiaoshi=小师
response.write "<td ><input name=bcpxh"&i&" type=text onkeyup='input_value();' size=20></td>"
next<SCRIPT LANGUAGE="JavaScript">
<!--
function input_value(){
for (i=1;i<=<%=num%>;i++)
{
eval("document.firstform.bcpxh1" + i).value = this.value;
}
}
//-->
</SCRIPT>