小女子 着急,大家帮帮忙!!!!!

michelle0618 2004-04-30 11:47:40
各位大侠!
比如页面我有如下
<P><INPUT id=file1 type=file name=file1 size="50"> <input type=hidden name="f1" value="11"></P>
<P><INPUT id=file2 type="file" size="50" name=file2> <input type=hidden name="f2" value="22"></P>
<P><INPUT id=file3 type="file" size="50" name=file3> <input type=hidden name="f3" value="33"></P>
<P><INPUT id=file4 type="file" size="50" name=file4> <input type=hidden name="f4" value="44"></P>
<P><INPUT id=file5 type="file" size="50" name=file5> <input type=hidden name="f4" value="55"></P>五个 <input>

我在javascript中代码
for(var i=1;i<6;i++){
var n= "f"+i;
var nn = "file" + i;
if(a == document.form.f1.value)
document.form.file1.click();
}

我怎么把 document.form.f1.value 中的“f1“用比如 变量 n 来替换?
把 document.form.file1.click();中的“file1“用比如 变量 nn来替换?

请各位高手帮忙!!!小女子不胜感激!!!
...全文
62 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
心云意水 2004-05-07
  • 打赏
  • 举报
回复
回复人: shuibinlang(阿水) ( ) 信誉:100 2004-05-07 13:50:00 得分:0


<input type="hidden" id="input1" value="11">

谁敢怀疑以下语句有错???

window["docu" + "ment"].all["in" + "put" + 1].value

既然如此,那问题的最好解决方法就不言而喻了
==================================================================================
嘿嘿~~
<input type="hidden" id="input1" value="11">
<button onclick=alert(window["docu" + "ment"].all["in"+"put"+1].value)></button>

运行一下,有没有错误不用人说……


shuibinlang 2004-05-07
  • 打赏
  • 举报
回复
<input type="hidden" id="input1" value="11">

谁敢怀疑以下语句有错???

window["docu" + "ment"].all["in" + "put" + 1].value

既然如此,那问题的最好解决方法就不言而喻了
52juanjuan 2004-05-06
  • 打赏
  • 举报
回复
for(var i=1;i<6;i++){
var n= "f"+i;
var nn = "file" + i;
if(a == document.form.f1.value)
document.form.file1.click();
}

我怎么把 document.form.f1.value 中的“f1“用比如 变量 n 来替换?
在php里面可以用
$f="f".$i;
$filename=$$f;
把 document.form.file1.click();中的“file1“用比如 变量 nn来替换?
$file="file".$i
$fileurl=$$file;
dullwolf 2004-05-06
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/3034/3034331.xml?temp=.4976465
参考这个,这样也可以。
shuibinlang 2004-05-06
  • 打赏
  • 举报
回复
for(var i=1;i<6;i++){
if(a == document.form['f' + 1].value)
document.form['file' + 1].click();
}

bribin 2004-04-30
  • 打赏
  • 举报
回复
var n=eval("f"+i);
var nn=eval("file"+i);
wanghr100 2004-04-30
  • 打赏
  • 举报
回复
if(a == document.form.f1.value)
document.form.file1.click();

->

if(a == document.all[n].value)
document.all[nn].click();
kinzey 2004-04-30
  • 打赏
  • 举报
回复
var obj1=eval("document.form."+n)
var obj2=eval("document.form."+nn)
if(a==obj1.value) obj2.click()
希默软件 2004-04-30
  • 打赏
  • 举报
回复
if(a == eval("document.form."+n).value)
eval("document.form."+nn).click();

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧