<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style type="text/css">
*{margin:0;padding:0;}
a{text-decoration: none;}
li{list-style: none;border:1px solid red;width:100px;height:auto;}
img{
display: inline-block;
width: 100%;
}
a{font-size:18px;color:red;}
#box{
position: relative;
width: 1200px;
margin: auto;
text-align: center;
}
img{
width:200px;
}
#pic2{
position: absolute;
right: 295px;
}
.none{
display: none;
}
.active{
display: inline-block;
}
</style>
</head>
<body>
<div id="box">
<img src="1.jpg" alt="" id="pic1">
<img src="6.jpg" id="pic2" class='none'>
</div>
<script>
var obox = document.getElementById('box');
var opic1 = document.getElementById('pic1');
var opic2 = document.getElementById('pic2');
pic1.onmouseover = function(){
opic2.className = 'active';
}
pic1.onmouseout = function(){
opic2.className = 'none';
}
</script>
</body>
</html>