大家好,在这里有个问题请教一下,我现在做了一个链接,当鼠标点击连接的时候显示一个DIV层,现在能实现到鼠标移动到链接上则显示链接名,那我想请问下,我该如何做到,将鼠标移动到链接上,则显示其对应数据库中记录。代码如下
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>show div and move on div</title>
<style type="text/css">
.floatPic{
display:none;
position:absolute;
width:200px;
height:10;
boder:1px;
background:lightblue;
}</style>
<script type="text/javascript">
var fhide=true;
function ShowFloatPic(obj)
{
fhide=false;
var div=document.getElementById("divinfo");
div.innerHTML="";
var itext=obj.firstChild.nodeValue;
var tnode=document.createTextNode(itext,true);
div.appendChild(tnode);
div.style.display="block";
div.style.left=event.clientX+30;
div.style.top=event.clientY;
} function prepareHide()
{
fhide=true;
setTimeout("tryHide()",500);
//setTimeout(function(){if (fhide){HideFloatPic();}},500);
} function tryHide()
{
if (fhide)
{
HideFloatPic();
}
} function HideFloatPic()
{
var div=document.getElementById("divinfo");
div.style.display="none";
}
function cancelHide()
{
fhide=false;
}</script>
</head><body style="margin:0;padding:0">
<li><a href="#" onmouseover="ShowFloatPic(this)" onmouseout="prepareHide(this)">作番1</a></li>
<li><a href="#" onmouseover="ShowFloatPic(this)" onmouseout="prepareHide(this)">作番2</a></li>
<li><a href="#" onmouseover="ShowFloatPic(this)" onmouseout="prepareHide(this)">作番3</a></li>
<li><a href="#" onmouseover="ShowFloatPic(this)" onmouseout="prepareHide(this)">作番4</a></li>
<div id="divinfo" class="floatPic" onmouseover="cancelHide();" onmouseout="HideFloatPic();" ></div>
</body></html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>show div and move on div</title>
<style type="text/css">
.floatPic{
display:none;
position:absolute;
width:200px;
height:10;
boder:1px;
background:lightblue;
}</style>
<script type="text/javascript">
var fhide=true;
function ShowFloatPic(obj)
{
fhide=false;
var div=document.getElementById("divinfo");
div.innerHTML="";
var itext=obj.firstChild.nodeValue;
var tnode=document.createTextNode(itext,true);
div.appendChild(tnode);
div.style.display="block";
div.style.left=event.clientX+30;
div.style.top=event.clientY;
} function prepareHide()
{
fhide=true;
setTimeout("tryHide()",500);
//setTimeout(function(){if (fhide){HideFloatPic();}},500);
} function tryHide()
{
if (fhide)
{
HideFloatPic();
}
} function HideFloatPic()
{
var div=document.getElementById("divinfo");
div.style.display="none";
}
function cancelHide()
{
fhide=false;
}</script>
</head><body style="margin:0;padding:0">
<li><a href="#" onmouseover="ShowFloatPic(this)" onmouseout="prepareHide(this)">作番1</a></li>
<li><a href="#" onmouseover="ShowFloatPic(this)" onmouseout="prepareHide(this)">作番2</a></li>
<li><a href="#" onmouseover="ShowFloatPic(this)" onmouseout="prepareHide(this)">作番3</a></li>
<li><a href="#" onmouseover="ShowFloatPic(this)" onmouseout="prepareHide(this)">作番4</a></li>
<div id="divinfo" class="floatPic" onmouseover="cancelHide();" onmouseout="HideFloatPic();" ></div>
</body></html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货