<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<ul>
<li>00000000</li>
<li>11111111</li>
<li>22222222</li>
<li>33333333</li>
</ul>
<script>
function outFun(x){
function inFun(){
console.log(x);
}
return inFun;
}
var lis = document.getElementsByTagName('li');
for(var i=0; i<lis.length; i++){
lis[i].onclick = outFun(i);
}
</script>
</body>
</html>