废话不多直接上代码
<ul id="ulCont">
<li>111</li>
<li>222</li>
<li>333</li>
<li>444</li>
</ul>
window.onload = function () {
var ele = document.getElementById("ulCont");
ele.onclick = function (e) {
var e = e || window.event;
var target = e.target || window.srcElement; // window.srcElement兼容IE
if(target.nodeName.toLowerCase == "li") {
console.log(target.innerHtml);
}
}
}
over,白白