关于鼠标旁边出现提示消息的JS... <a href="#" title="area">a</a><img src="http://www.csdn.net/Images/logo_csdn.gif" title="csdn" /> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 大哥,不用title和alt来显示信息...用JS来即时显示消息....同时我想问一下,好像event事件在FireFox下面经常报错.. 手头没有兼容性好的event在FireFox中要显式传过去才能用 <html><head><title>提示菜单</title><script>var x,yfunction canMove(){ x=document.body.scrollLeft+event.clientX y=document.body.scrollTop+event.clientY}function move(){ tips.style.posLeft=x+10; tips.style.posTop=y+10; setTimeout("move()",10);}function showTips(content,obj){ obj.innerText=content+"\t\t\t\t\t\t"; obj.filters.alpha.opacity=100;}function hideTips(content,obj){//more javascript from http://cfan.net.cn obj.innerText=content; obj.filters.alpha.opacity=0;}document.write("<div id=tips style='filter:alpha(opacity=0);position:absolute;background-color:#f3f3f3;font-size:9pt;color:#6c6c6c;border:#d9d9c6 1px solid;'></div>");</script></head><body onload="move()" onmousemove="canMove()"><table cellspacing=0 cellpadding=0 border=0 width=760 align=center> <tr> <td height=40> <a href="#"><span onmouseover="showTips('魔鬼列车最新版本最新上传',tips)" onmouseout="hideTips('',tips)">1</span></a> </td> </tr> <tr> <td height=40> <a href="#"><span onmouseover="showTips('你好世界',tips)" onmouseout="hideTips('',tips)">2</span></a> </td> </tr> <tr> <td height=40> <a href="#"><span onmouseover="showTips('你好世界',tips)" onmouseout="hideTips('',tips)">3</span></a> </td> </tr> <tr> <td height=40> <a href="#"><span onmouseover="showTips('你好世界',tips)" onmouseout="hideTips('',tips)">4</span></a> </td> </tr> <tr> <td height=40> <a href="#"><span onmouseover="showTips('你好世界',tips)" onmouseout="hideTips('',tips)">5</span></a> </td> </tr></table></body></html> <html><head><title>dfjk</title></head><body><div id="div_Tip" style="BORDER-RIGHT: #666699 1px solid; BORDER-TOP: #666699 1px solid; DISPLAY: none; PADDING-LEFT: 10px; Z-INDEX: 500; LEFT: 448px; VERTICAL-ALIGN: baseline; BORDER-LEFT: #666699 1px solid; WIDTH: 150px; COLOR: #000000; PADDING-TOP: 10px; BORDER-BOTTOM: #666699 1px solid; POSITION: absolute; TOP: 240px; HEIGHT: 50px; BACKGROUND-COLOR: #efeff9; TEXT-ALIGN: left" width="100px" name="div_Tip">是不是这样子?<br></div><img src="D:\ITurbo\source\cecerp\IE\Libraries\Images\3D\DeleteRec.GIF" onmouseover="ShowTip()" style="CURSOR: hand" onmouseout="HideTip()" border="0" /><script>function ShowTip(){ document.getElementById("div_Tip").style.display = 'block'; document.getElementById("div_Tip").style.left=event.x +10 ; document.getElementById("div_Tip").style.posTop=event.y + 10;}function HideTip(){ document.getElementById("div_Tip").style.display = 'none'; }</script></body></html>在FF中好像得修改 感谢楼上几位大哥....在IE下面出现的提示,我自己也会写,,,,为了兼容,我想在FireFox下面也能正常显示..但是我不知道怎么写?那位大哥会?? <html><head><title>dfjk</title></head><body><div id="div_Tip" style="BORDER-RIGHT: #666699 1px solid; BORDER-TOP: #666699 1px solid; DISPLAY: none; PADDING-LEFT: 10px; Z-INDEX: 500; LEFT: 448px; VERTICAL-ALIGN: baseline; BORDER-LEFT: #666699 1px solid; WIDTH: 150px; COLOR: #000000; PADDING-TOP: 10px; BORDER-BOTTOM: #666699 1px solid; POSITION: absolute; TOP: 240px; HEIGHT: 50px; BACKGROUND-COLOR: #efeff9; TEXT-ALIGN: left" width="100px" name="div_Tip">aaaaaaaaaaaaaaaaaaa<br></div><div onmouseout="HideTip(event)" onmouseover="ShowTip(event)">ccccccccccccc</div><script>function ShowTip(a){var event=a?a:window.event;var mX = event.x ? event.x : event.pageX;var my = event.y ? event.x : event.pageY;document.getElementById("div_Tip").style.display = 'block';document.getElementById("div_Tip").style.left=mX +10 ;document.getElementById("div_Tip").style.posTop=my + 10;}function HideTip(a){document.getElementById("div_Tip").style.display = 'none';}</script></body></html> to mingxuan3000(铭轩)谢谢你,效果还不错,就是提示框距离鼠标太远了... 忽忽。他手误写错了改成这个就可以了。var my = e.y ? e.y : e.pageY; php往js传值的问题 jquery对比验证的问题 急 如何知道一个图片链接失败自动使用下一个链接? 在线等,跪求答案。。JAVASCRIT高手请进!!! 帮忙看看!急!!!在线等! 请各位高手帮忙:怎样捕捉IE浏览器的关闭事件亦或怎样才能让IE浏览器的关闭(X)无效 如何让用户只输入英文和数字? 在网页中怎样实现向下填充的功能。高分求救 如何自动下载服务器上的文件到本地? 100 在线等候 怎么在关闭浏览器时弹出提示 appendChild的一个奇怪问题,大家来看看 一个关于变量的简单问题(在线)
同时我想问一下,好像event事件在FireFox下面经常报错..
event在FireFox中要显式传过去才能用
<html>
<head>
<title>提示菜单</title>
<script>
var x,y
function canMove()
{
x=document.body.scrollLeft+event.clientX
y=document.body.scrollTop+event.clientY
}
function move()
{
tips.style.posLeft=x+10;
tips.style.posTop=y+10;
setTimeout("move()",10);
}
function showTips(content,obj)
{
obj.innerText=content+"\t\t\t\t\t\t";
obj.filters.alpha.opacity=100;
}
function hideTips(content,obj)
{//more javascript from http://cfan.net.cn
obj.innerText=content;
obj.filters.alpha.opacity=0;
}
document.write("<div id=tips style='filter:alpha(opacity=0);position:absolute;background-color:#f3f3f3;font-size:9pt;color:#6c6c6c;border:#d9d9c6 1px solid;'></div>");
</script>
</head>
<body onload="move()" onmousemove="canMove()"><table cellspacing=0 cellpadding=0 border=0 width=760 align=center>
<tr>
<td height=40>
<a href="#"><span onmouseover="showTips('魔鬼列车最新版本最新上传',tips)" onmouseout="hideTips('',tips)">1</span></a>
</td>
</tr>
<tr>
<td height=40>
<a href="#"><span onmouseover="showTips('你好世界',tips)" onmouseout="hideTips('',tips)">2</span></a>
</td>
</tr>
<tr>
<td height=40>
<a href="#"><span onmouseover="showTips('你好世界',tips)" onmouseout="hideTips('',tips)">3</span></a>
</td>
</tr>
<tr>
<td height=40>
<a href="#"><span onmouseover="showTips('你好世界',tips)" onmouseout="hideTips('',tips)">4</span></a>
</td>
</tr>
<tr>
<td height=40>
<a href="#"><span onmouseover="showTips('你好世界',tips)" onmouseout="hideTips('',tips)">5</span></a>
</td>
</tr>
</table>
</body>
</html>
<head>
<title>
dfjk</title>
</head>
<body>
<div id="div_Tip" style="BORDER-RIGHT: #666699 1px solid; BORDER-TOP: #666699 1px solid; DISPLAY: none; PADDING-LEFT: 10px; Z-INDEX: 500; LEFT: 448px; VERTICAL-ALIGN: baseline; BORDER-LEFT: #666699 1px solid; WIDTH: 150px; COLOR: #000000; PADDING-TOP: 10px; BORDER-BOTTOM: #666699 1px solid; POSITION: absolute; TOP: 240px; HEIGHT: 50px; BACKGROUND-COLOR: #efeff9; TEXT-ALIGN: left" width="100px" name="div_Tip">是不是这样子?<br></div><img src="D:\ITurbo\source\cecerp\IE\Libraries\Images\3D\DeleteRec.GIF" onmouseover="ShowTip()" style="CURSOR: hand" onmouseout="HideTip()" border="0" />
<script>function ShowTip()
{
document.getElementById("div_Tip").style.display = 'block';
document.getElementById("div_Tip").style.left=event.x +10 ;
document.getElementById("div_Tip").style.posTop=event.y + 10;
}
function HideTip()
{
document.getElementById("div_Tip").style.display = 'none';
}
</script>
</body>
</html>在FF中好像得修改
<head>
<title>
dfjk</title>
</head>
<body>
<div id="div_Tip" style="BORDER-RIGHT: #666699 1px solid; BORDER-TOP: #666699 1px solid; DISPLAY: none; PADDING-LEFT: 10px; Z-INDEX: 500; LEFT: 448px; VERTICAL-ALIGN: baseline; BORDER-LEFT: #666699 1px solid; WIDTH: 150px; COLOR: #000000; PADDING-TOP: 10px; BORDER-BOTTOM: #666699 1px solid; POSITION: absolute; TOP: 240px; HEIGHT: 50px; BACKGROUND-COLOR: #efeff9; TEXT-ALIGN: left" width="100px" name="div_Tip">aaaaaaaaaaaaaaaaaaa<br></div><div onmouseout="HideTip(event)" onmouseover="ShowTip(event)">ccccccccccccc</div>
<script>function ShowTip(a)
{
var event=a?a:window.event;
var mX = event.x ? event.x : event.pageX;
var my = event.y ? event.x : event.pageY;
document.getElementById("div_Tip").style.display = 'block';
document.getElementById("div_Tip").style.left=mX +10 ;
document.getElementById("div_Tip").style.posTop=my + 10;
}
function HideTip(a)
{
document.getElementById("div_Tip").style.display = 'none';}
</script>
</body>
</html>
谢谢你,效果还不错,就是提示框距离鼠标太远了...
他手误写错了改成这个就可以了。
var my = e.y ? e.y : e.pageY;