<body>
<script>
function this_index_input(obj){
this_=document.getElementsByName(obj.name);
alert(this_.index);
}
</script>
<input type= "text " name= "textfield[] " onClick= "this_index_input(this) "> <input type= "text " name= "textfield[] " onClick= "this_index_input(this) "> <input type= "text " name= "textfield[] " onClick= "this_index_input(this) "> <input type= "text " name= "textfield[] " onClick= "this_index_input(this) ">
</body>
------解决方案--------------------
<script>
function this_index_input(obj){
var list = document.form1.elements[ "textfield[] "];
for(var i=0;i <list.length;i++){
if (list[i]==obj){
alert(i);
break;
}
}
}
</script>
<form name= "form1 ">
<input type= "text " name= "textfield[] " onClick= "this_index_input(this) "> <input type= "text " name= "textfield[] " onClick= "this_index_input(this) "> <input type= "text " name= "textfield[] " onClick= "this_index_input(this) "> <input type= "text " name= "textfield[] " onClick= "this_index_input(this) ">
</form>