H5 JS鼠标选中和移出事件
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="show" style="width: 300px;height: 200px;background: #8A2BE2;">世间行乐亦如此,古来万事东流水。</div>
<img style="display: none;" src="meizi.jpg" width="300px;">
</body>
<script>
var show=document.getElementById('show')
var meizi=document.getElementsByTagName('img')[0]
show.onmouseover=function(){
meizi.style.display='inline'
}
show.onmouseout=function(){
meizi.style.display="none"
}
</script>
</html>
效果:鼠标放在诗句模块上,展示下面的黑人表情包,移出鼠标,图片隐藏