日期:2014-05-16  浏览次数:20362 次

js鼠标移动显示层
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="images/blue/css.css" rel="stylesheet" type="text/css" id="showdialogcss" />
<script>
function showlianxi(status,ev){
var  e= ev||window.event;
var show = document.getElementById('showlianxi');
var obj=e.target||e.srcElement;
switch(status){
case 'over':
show.style.position='absolute';
if(e.pageX){
show.style.left=e.pageX+20+'px';
show.style.top=e.pageY+'px';
}
else{
show.style.left=e.clientX + document.body.scrollLeft+ document.documentElement.scrollLeft+5;
show.style.top=e.clientY + document.body.scrollTop+ document.documentElement.scrollTop+5;
}
show.style.display='block';
break;
case 'out':
show.style.display='none';
break;
}
}

</script>
<style type="text/css">
#showlianxi{
background:url(images/lianxibg.jpg) no-repeat;
width:175px;
height:62px;
padding:20px 0px 0px 8px;
display:none;
z-index:100;
display:none;
}
#showlianxi .phoneimg{
float:left;
padding-right:7px;
}
#showlianxi .phone{float:left; font-size:11px;}

.pin_name{
background:url(images/min1.gif) no-repeat;
line-height:28px;
font-weight:bold;
text-align:center;
margin:0 auto;
width:148px;
border:1px solid #ccc;
}

</style>
</head>
<body>
<div class="pin_name" onmouseover="showlianxi('over',event)" onmouseout="showlianxi('out',event)">
<a class="black" href="/store/store.action?id=1">百事公司</a>
</div>
<br />
<div class="pin_name" onmouseover="showlianxi('over',event)" onmouseout="showlianxi('out',event)">
<a class="black" href="/store/store.action?id=1">百事公司</a>
</div>

<div id="showlianxi"  onmouseover="showlianxi('over',event)" onmouseout="showlianxi('out',event)">
<div style="height:25px;line-height:25px;">
<div class="phoneimg"><img src="http://www.iteye.com/images/icon_minigender_1.gif?1192779195" width="16" height="14" /></div>
<div class="phone"></div>
<div class="clear"></div>
</div>
    <div style="height:25px;line-height:25px;">
         <div class="phoneimg"><img src="http://www.iteye.com/images/icon_minigender_1.gif?1192779195" width="16" height="15"/></div>
         <div class="float_left"></div>
         <div class="clear"></div>
    </div>
</div>


</body>
</html>