关于获取鼠标坐标的问题

key_pwd 2004-01-14 02:18:24
我现在需要获取鼠标的坐标,然后在鼠标的右下角显示一个层
而且,该页面有多个层需要这样显示
我在VS.Net的MSDN中找到了类似的,但不好用

哪位朋友知道,洗耳恭听
...全文
54 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhfkiller 2004-01-14
  • 打赏
  • 举报
回复
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<div id="tip" style="position:absolute;BACKGROUND: #dddd00; WIDTH: 80px; HEIGHT: 50px; display:'none'">
  tips 1
<br>
  remark
</div>
<script>
window.document.body.onmousedown = function (){
tip.style.top = event.y;
tip.style.left = event.x;
tip.style.display = '';
}
window.document.body.onmouseup = function (){
tip.style.display = 'none';
}
</script>
</BODY>
</HTML>
多菜鸟 2004-01-14
  • 打赏
  • 举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//-->
</script>
<style type="text/css">
.Layer1{
filter: Alpha(Opacity=10);
}
</style>
</head>

<body>

<div id="Layer1" style="position:absolute;left:91px;display:none; top:29px; width:128px; height:127px; z-index:1; background-color: #CEECFF; layer-background-color: #CEECFF; border: 1px none #000000;" class="Layer1">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td><p>================</p>
<p>================</p>
<p>================</p>
<p>================</p>
</td>
</tr>
</table>

</div>
<script language="JavaScript">
<!--
function filteralpha(){
i+=25;
Layer1.filters.alpha.opacity=i;
if(Layer1.filters.alpha.opacity>=100)return;
setTimeout('filteralpha()',200);
}
function showmenuie5() {
var rightedge = document.body.clientWidth-event.clientX;
var bottomedge = document.body.clientHeight-event.clientY;
if (rightedge < Layer1.offsetWidth)
Layer1.style.left = document.body.scrollLeft + event.clientX - Layer1.offsetWidth;
else
Layer1.style.left = document.body.scrollLeft + event.clientX;
if (bottomedge < Layer1.offsetHeight)
Layer1.style.top = document.body.scrollTop + event.clientY - Layer1.offsetHeight;
else
Layer1.style.top = document.body.scrollTop + event.clientY;
Layer1.style.display='';
i=10;
filteralpha();
return false;
}
function hidemenu(){
Layer1.style.display='none';
}
document.oncontextmenu=showmenuie5;
document.body.onclick=hidemenu;
//-->
</script>
</body>
</html>

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧