<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<script language="JavaScript" type="Text/Javascript">
<!--
window.onload=function(){
var o=document.getElementById("demo").getElementsByTagName("input");
for(var i=0; i<o.length; i++){
obj=o[i];
obj.onclick=function(){
alert(obj.value)
}
}
}
//-->
</script>
</head>
<body>
<div id="demo">
<input type="button" value="a" />
<input type="button" value="b" />
<input type="button" value="c" />
<input type="button" value="d" />
<input type="button" value="e" />
</div>
</body>
</html>
执行结果,alert始终只报最后一个对象的值,哪里写错了呢?望指教!!