日期:2014-05-16  浏览次数:20427 次

js精髓啊

<input type="button" value="ddd">
<input type="button" value="ddd">
<input type="button" value="ddd">

<script>
	var nodes = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < nodes.length; i += 1) {
        nodes[i].onclick = function (i) {
				return function (){
					alert(i);
				}
        }(i);
    }
</script>  
?