Div层覆盖点击位置显示

		<script language="JavaScript">  
     
	  function   popUp()   {   
	  newX   =   window.event.x   +   document.getElementById("mmm").scrollLeft;   
	  newY   =   window.event.y   +   document.getElementById("mmm").scrollTop;
	var p = document.getElementById("xxcb");
	var _x = p.offsetLeft;
	var _y = p.offsetTop;
	//这里递归获取p父级有css定位的offset
	while(p.offsetParent){
	_x += p.offsetLeft;
	_y += p.offsetTop;
	p = p.offsetParent;
	}
	  menu   =   document.all.itemopen; 
	  if (   menu.style.display   ==   ""){
		  menu.style.display   =   "none"  
	  } else{   
		menu.style.display   =   ""
	 }
  document.getElementById("mmm").style.left   =   _x-30  ;  
  document.getElementById("mmm").style.top   =   _y+30 ;   
  }   
  </script>

 

<div id="mmm" style="z-index: 9999;position: absolute;">
			<table id="itemopen" class="box" style="display: none">

 

你可能感兴趣的:(div)