<!DOCTYPE html><html><head><meta charset="utf-8"><title>获取标签的父结点和内容</title><script> function click_event(){ var im_content=document.getElementsByClassName('talk_time'); alert(im_content[0].parentNode); //获取父节点 alert(im_content[0].parentNode.innerHTML); //获取父节点的内容 }</script></head><body> <div class="talk_recordboxmine"> <div class="user" onclick='click_event()'> <img src="img/taobao.png">11 </div> <div class="talk_recordtext"> <h3>qqq</h3> <span class="talk_time" time_date="1531534632009">10:17</span> </div> </div></body></html>