sådan... forklaring kommer om en lille
½-1 time... skal lige have en lille pause :P
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"><title>Ingen titel</title>
<script type="text/javascript">
<!--
var IE=document.all?true:false;
if(!IE)document.captureEvents(Event.mousemove)
document.onmousemove=mousepos;
var cury=0;
var curx=0;
function mousepos(e){
if(IE){
tmpy=event.clientY;
tmpx=event.clientX;
}else{
tmpy=e.pageY;
tmpx=e.pageX;
}
cury=tmpy;
curx=tmpx;
}
tmpx1=0;
tmpx2=0;
tmpy1=0;
tmpx2=0;
tmpx1b=0;
tmpx2b=0;
tmpy1b=0;
tmpx2b=0;
tmpcurnode="";
function hideshowdiv(tmpid,tmpcur,pleft,ptop){
if(tmpid=document.getElementById(tmpid)){
if(tmpcurnode!="")tmpcurnode.style.visibility='hidden';
tmpcurnode=tmpid;
xleft=tmpcur.offsetLeft;
xtop=tmpcur.offsetTop;
tmpcur2=tmpcur;
while(tmpcur2=tmpcur2.offsetParent){
xleft=xleft+tmpcur2.offsetLeft;
xtop=xtop+tmpcur2.offsetTop;
}
tmpy1b=xtop;
tmpx1b=xleft;
tmpy2b=xtop+tmpcur.offsetHeight;
tmpx2b=xleft+tmpcur.offsetWidth;
tmpid.style.top=xtop+ptop+"px";
tmpid.style.left=xleft+pleft+"px";
tmpid.style.visibility='visible';
tmpy1=tmpid.offsetTop;
tmpx1=tmpid.offsetLeft;
tmpy2=tmpid.offsetTop+tmpid.offsetHeight;
tmpx2=tmpid.offsetLeft+tmpid.offsetWidth;
}
}
window.onload=runhidectrl;
function runhidectrl(){
if(tmpcurnode!=""){
if((curx<tmpx1)||(curx>tmpx2)||(cury<tmpy1)||(cury>tmpy2)){
if((curx<tmpx1b)||(curx>tmpx2b)||(cury<tmpy1b)||(cury>tmpy2b)){
tmpcurnode.style.visibility="hidden";
}
}
}
setTimeout("runhidectrl();",100);
}
//-->
</script>
</head>
<body onclick="alert(curx+'<'+tmpx1b);">
<div style="width:770px;margin:0px auto;position:relative;background-color:blue;">
<div style="float:left;width:200px;margin:0px auto;background-color:yellow;">
<img src="1.jpg" width="100" height="100" onmouseover="hideshowdiv('menu1',this,0,0)">
</div>
<div style="float:left;width:200px;margin:0px auto;background-color:yellow;">
<img src="1.jpg" width="100" height="100" onmouseover="hideshowdiv('menu2',this,0,50)">
</div>
</div>
<div id="menu1" style="visibility:hidden;position:absolute;top:0px;left:0px;background-color:green;"><br>
<img src="1.jpg" width="100" height="100">
</div>
<div id="menu2" style="visibility:hidden;position:absolute;top:0px;left:0px;background-color:green;"><br>
<img src="1.jpg" width="100" height="100">
</div>
</body></html>