<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>Untitled</title>

</head>
<body>
 
<table>
    
<tr><td></td><td></td><td></td></tr>
 
</table>
  
<script type="text/javascript">
  
for(i=0;i<3;i++){
     document.getElementsByTagName(
'td')[i].innerHTML=i;

     document.getElementsByTagName(
'td')[i].onclick=(function(i){
          
return function(){alert(i);}
     })(i)
    }
  
</script>
</body>
</html>

 

posted on 2011-09-11 08:53  钱途无梁  阅读(417)  评论(0编辑  收藏  举报