再说一下,各个数可能是相同的!
比如是11,11,11,11

解决方案 »

  1.   

    <form name="form1" method="post" action="">
      <input name="e" type="text" id="e" onClick="ok(this)" value="11" size="3">
      <input name="e" type="text" id="e" onClick="ok(this)" value="22" size="3">
      <input name="e" type="text" id="e" onClick="ok(this)" value="33" size="3">
      <input name="e" type="text" id="e" onClick="ok(this)" value="44" size="3">
      <input type="button" name="Submit" value="按钮">
    </form>
    <script>
    function ok(inputname){
    alert("该值为:"+inputname.value);
    //计算在数组中的位置
    var str;
    str=document.form1.e
    for(i=0;i<str.length;i++){
      if(document.form1.e[i]==inputname){
         alert("该值在数组中是第"+i+"位");
      }
    }
    }
    </script>
      

  2.   

    孟老大,我太崇拜你了!!!