let oUl =document.querySelector("ul")
oUl.onclick = function(ev){
let oEvent = ev || window.event;
let target = oEvent.target || oEvent.srcElement;
if(target.nodeName.toLowerCase()==='li') {
alert(target.innerHTML)
}
}
<ul>
<li>哈哈</li>
<li>苹果</li>
<li>香蕉</li>
<li>橘子</li>
<p>海豚</p>
<li>橙子</li>
<p>其他水果</p>
</ul>
*{margin: 0;padding: 0}
ul{width: 200px; margin: 0 auto;}
li,p{list-style: none; border: 1px solid #000; margin-top: 10px;}