鼠标移过显示提示信息框(自动获取鼠标坐标)

<head runat="server">
<title></title>
<script src="jquery-1.4.4.js" type="text/javascript"></script>
<script src="jquery.sparkline.min.js" type="text/javascript"></script>
<script type="text/javascript">
var mouseX;
var mouseY;
function mouseLeave() {
$("#infoDiv").css('display', 'none');
}
function mouseOver(obj) {
mouseX = event.clientX;
mouseY = event.clientY;
$("#infoDiv").html('单击弹出详细信息!');
$("#infoDiv").css('margin-left', mouseX);
// $("#infoDiv").css('margin-top', '-80px');
infoDiv.style.display = "block";
}

function mouseOver1(obj) {
mouseX = event.clientX;
mouseY = event.clientY;

$("#infoDiv").html('单击弹出第二信息!');

$("#infoDiv").css('margin-left', mouseX);
// $("#infoDiv").css('margin-top', '-80px');
infoDiv.style.display = "block";
}
</script>
<script type="text/javascript">
$(document).ready(function () {
$(".cc").sparkline('html', { 'width': 160 });
})
</script>
</head>
<body>
<form id="form1" runat="server">
<br />
<br />
<br />
<br />
<br />
<br />
<div style="margin-left:500px; width:270px;">
<table><tr><td onmouseover="mouseOver1()" onmouseout="mouseLeave()">单击一:</td><td></td><td><a class="cc" onmouseover="mouseOver()" onmouseout="mouseLeave()">1,24,45,15,6,56,7,15,20,14,1,0,15,8</a></td></tr></table></div>

<div id="infoDiv" style="display: none; position: absolute; margin-top:-80px; width: 180px; height: 25px; background-color: #F1F19B;"></div>
</form>
</body>
</html>

你可能感兴趣的:(获取)