将鼠标轻轻地放在链接上,层会跟过来
2004-07-20 10:54
309 查看
<html>
<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);
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d
)&&d.all) x=d.all
; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i]
;
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
<body>
<p><a href="#" onMouseOver="ShowMenu('Layer1');" onMouseOut="MM_showHideLayers('Layer1','','hide')"> AA</a></p>
<div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1; left: 321px; top: 271px;">BB</div>
<script language="javascript">
function ShowMenu(MyLayer)
{
if (document.layers) getMouseLoc; //NS
else if (document.all) getMouseLoc(); //IE
//MM_showMenu(window.mm_menu_0720085132_0,mouseLocation.x,30,null,'link2');
var obj;
if ((obj=MM_findObj(MyLayer))!=null)
{
if (obj.style) { obj=obj.style; }
obj.left = mouseLocation.x+30 || window.pageX || 0;
//if (obj.left + l.clip.width > window.innerWidth)
//obj.left -= (obj.left + l.clip.width - window.innerWidth);
obj.top = mouseLocation.y+20 || window.pageY || 0;
}
MM_showHideLayers(MyLayer,'','show');
}
function Point(x,y) { this.x = x; this.y = y; }
mouseLocation = new Point(-500,-500);
function getMouseLoc(e)
{
if(!document.all) //NS
{
mouseLocation.x = e.pageX;
mouseLocation.y = e.pageY;
}
else //IE
{
mouseLocation.x = event.x + document.body.scrollLeft;
mouseLocation.y = event.y + document.body.scrollTop;
}
return true;
}
//NS init:
if(document.layers){ document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; }
</script>
</body></html>
<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);
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d
)&&d.all) x=d.all
; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i]
;
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
<body>
<p><a href="#" onMouseOver="ShowMenu('Layer1');" onMouseOut="MM_showHideLayers('Layer1','','hide')"> AA</a></p>
<div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1; left: 321px; top: 271px;">BB</div>
<script language="javascript">
function ShowMenu(MyLayer)
{
if (document.layers) getMouseLoc; //NS
else if (document.all) getMouseLoc(); //IE
//MM_showMenu(window.mm_menu_0720085132_0,mouseLocation.x,30,null,'link2');
var obj;
if ((obj=MM_findObj(MyLayer))!=null)
{
if (obj.style) { obj=obj.style; }
obj.left = mouseLocation.x+30 || window.pageX || 0;
//if (obj.left + l.clip.width > window.innerWidth)
//obj.left -= (obj.left + l.clip.width - window.innerWidth);
obj.top = mouseLocation.y+20 || window.pageY || 0;
}
MM_showHideLayers(MyLayer,'','show');
}
function Point(x,y) { this.x = x; this.y = y; }
mouseLocation = new Point(-500,-500);
function getMouseLoc(e)
{
if(!document.all) //NS
{
mouseLocation.x = e.pageX;
mouseLocation.y = e.pageY;
}
else //IE
{
mouseLocation.x = event.x + document.body.scrollLeft;
mouseLocation.y = event.y + document.body.scrollTop;
}
return true;
}
//NS init:
if(document.layers){ document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; }
</script>
</body></html>
相关文章推荐
- 怎么设在鼠标指针放在链接上时指针不变.txt
- (源码实例)通过层DIV实现,当鼠标放在链接上面,显示图片及文字
- 在网页中,鼠标放在Flash链接上,光标形状会在手型和鼠标之间不停的闪 的解决办法
- [特效]鼠标放在链接丄时显示自定义的指针
- (源码实例)通过层DIV实现,当鼠标放在链接上面,显示图片及文字
- (源码实例)通过层DIV实现,当鼠标放在链接上面,显示图片及文字 - 流星絮语 JAVA学习笔记 - CSDNBlog
- (源码实例)通过层DIV实现,当鼠标放在链接上面,显示图片及文字
- 鼠标放在小图片上显示大图标
- 鼠标放在预览图a.gif上,旁边有放大图出现
- 鼠标放在图片上,出来小tips
- 不加链接 鼠标放上去出现小手标识的样式
- 鼠标放在表格上使当前行高亮显示
- html title换行方法 如a链接标签内title属性鼠标悬停提示内容换行
- 鼠标放在小图片上显示大图标
- CheckBoxList 控件ListItem项 添加ToolTip属性(鼠标放在上面时,有提示)
- JS实现把鼠标放到链接上出现滚动文字的方法
- 鼠标放在文章标题上,下划线改变颜色
- 鼠标滑过图片变暗文字链接滑出jQuery特效
- 鼠标放在一个连接上,会显示图片(类似tooltip)
- 鼠标使链接变色