浙林龙哥

   :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

<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[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  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>

posted on 2004-07-20 10:54  浙林龙哥  阅读(780)  评论(0编辑  收藏  举报