<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body onload=showLi()>
<ul id="myUl">
<li>111</li>
<li>222</li>
<li>333</li>
</ul>
</body>
</html>
<script type="text/javascript">
<!--
function showLi(){
var ul=document.getElementById("myUl");
var lis=ul.getElementsByTagName("li");
for(var i=0;i<lis.length;i++){
lis[i].onclick=function(){
alert(this.innerHTML);// this是关键
};
}
}
//-->
</script>