获取鼠标经过处的标签的标签名和id
<script>
var el = window.document.body; // 声明一个变量,默认值为body
window.document.body.onmouseover = function(event){
el = event.target; // 鼠标每经过一个元素,就把该元素赋值给变量el
// console.log(el.nodeName);
console.log(el.id);
}
</script>

浙公网安备 33010602011771号