반응형
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function test(obj){
var tc = document.getElementsByName(obj.name);
for(var i=0; tc.length; i++){
if(tc[i] == obj){
var j = i;
break;
}
}
alert(j);
}
//-->
</SCRIPT>
<BODY>
<INPUT TYPE="text" NAME="aaa" ONCLICK="test(this);"><INPUT TYPE="button" name="btn" VALUE="" ONCLICK="test(this);">
<INPUT TYPE="text" NAME="aaa" ONCLICK="test(this);"><INPUT TYPE="button" name="btn" VALUE="" ONCLICK="test(this);">
</BODY>
</HTML>