带参数的对象问题
<input type= "button " onclick= "javascript:d(1) ">
<input name= "tel1 " type= "text " id= "tel "/>
<input type= "button " onclick= "javascript:d(2) ">
<input name= "tel2 " type= "text " id= "tel "/>
<input type= "button " onclick= "javascript:d(3) ">
<input name= "tel3 " type= "text " id= "tel "/>
<script>
function d(i)
{
a=form1.(tel+i).value;
alert(a);
}
</script>
好像不能(tel+i)这样子写,请帮帮忙.谢谢!
------解决方案--------------------a=eval( "document.form1.tel " + i + ".value ");
或者
a = document.form1.elements[ "tel " + i].value;