Ich mach das selbe ganz anders. Mein Div bleibst ständig neben der Maus, ist aber unsichtbar. Nur wenn ich über den Link fahre wird es sichtbar.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type=text/javascript>
<!--
function init() {
checkQuer();
Fensterbreite();
Fensterhoehe();
Mauspos();
}
////Infotip
//Mausposition
var isOpera = (window.opera)?true:false;
var isO = navigator.appVersion.indexOf("MSIE");
var isOp = Number(navigator.appVersion.slice(isO+4,isO+7));
var isOperaneu = (window.opera && isOp > 5)?true:false;
var isIE = (document.all && !isOpera);
//var isNN = (document.layers && !isOpera);
var Xpos = 0;
var Ypos = 0;
var Xscroll = 0;
var Yscroll = 0;
var fensterbreite = 500;
var fensterhoehe = 400;
function Mauspos(){
if(isIE) document.onmousemove = MouseMotionHandlerIE
else if(isOpera) {
if (isOperaneu) document.onmousemove = MouseMotionHandlerOperaneu
else document.onmousemove = MouseMotionHandlerOpera
} else {
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = MouseMotionHandlerNN;
}
}
function MouseMotionHandlerNN(event) {
savePos(event.pageX, event.pageY, window.pageXOffset, window.pageYOffset);
moveBox(Xpos, Ypos);
}
function MouseMotionHandlerIE() {
savePos(window.event.x, window.event.y, document.body.scrollLeft, document.body.scrollTop);
moveBox(Number(Xpos)+Number(Xscroll), Number(Ypos) + Number(Yscroll));
}
function MouseMotionHandlerOpera() {
savePos(window.event.x, window.event.y, document.body.scrollLeft, document.body.scrollTop);
moveBox(Xpos, Ypos);
}
function MouseMotionHandlerOperaneu() {
savePos(window.event.x, window.event.y, document.body.scrollLeft, document.body.scrollTop);
moveBox(Xpos+Xscroll, Ypos+Yscroll);
}
function moveBox(x, y) {
if (isIE||(isOpera && isOperaneu)) {
if (x-document.body.scrollLeft+296<=fensterbreite) {
document.getElementById("ntcaw").style.left = x*1+16;
} else {
if (x-document.body.scrollLeft>=296) {
document.getElementById("ntcaw").style.left = x*1-296;
} else {
document.getElementById("ntcaw").style.left = document.body.scrollLeft;
}
}
if (y-document.body.scrollTop+316<=fensterhoehe) {
document.getElementById("ntcaw").style.top = y*1+16;
} else {
if (y-document.body.scrollTop>=316) {
document.getElementById("ntcaw").style.top = y*1-316;
} else {
document.getElementById("ntcaw").style.top = document.body.scrollTop;
}
}
} else {
if (isOpera && !isOperaneu) {
if (x-window.pageXOffset+296<=fensterbreite) {
document.getElementById("ntcaw").style.left = x*1+16;
} else {
if (x-window.pageXOffset>=296) {
document.getElementById("ntcaw").style.left = x*1-296;
} else {
document.getElementById("ntcaw").style.left = window.pageXOffset;
}
}
if (y-window.pageYOffset+316<=fensterhoehe) {
document.getElementById("ntcaw").style.top = y*1+16;
} else {
if (y-window.pageYOffset>=316) {
document.getElementById("ntcaw").style.top = y*1-316;
} else {
document.getElementById("ntcaw").style.top = window.pageYOffset;
}
}
} else {
if (x-window.pageXOffset+296<=fensterbreite) {
document.getElementById("ntcaw").style.left = x*1+16;
} else {
if (x-window.pageXOffset>=296) {
document.getElementById("ntcaw").style.left = x*1-296;
} else {
document.getElementById("ntcaw").style.left = window.pageXOffset;
}
}
if (y-window.pageYOffset+316<=fensterhoehe) {
document.getElementById("ntcaw").style.top = y*1+16;
} else {
if (y-window.pageYOffset>=316) {
document.getElementById("ntcaw").style.top = y*1-316;
} else {
document.getElementById("ntcaw").style.top = window.pageYOffset;
}
}
}
}
}
function savePos(Xposnew, Yposnew, Xscrollnew, Yscrollnew) {
Xpos = Xposnew;
Ypos = Yposnew;
Xscroll = Xscrollnew;
Yscroll = Yscrollnew;
}
function einblenden() {
document.getElementById("ntcaw").style.visibility = "visible";
}
function ausblenden() {
document.getElementById("ntcaw").style.visibility = "hidden";
}
function Fensterbreite() {
if (window.innerWidth) {fensterbreite=window.innerWidth};
if (document.body && document.body.offsetWidth) {fensterbreite=document.body.offsetWidth};
}
function Fensterhoehe() {
if (window.innerHeight) {fensterhoehe=window.innerHeight;}
else if (document.body && document.body.offsetHeight) {fensterhoehe=document.body.offsetHeight;}
}
//-->
</script>
<body onLoad="init()" onResize="init()">
<div id="ntcaw">Content</div>
Seiteninhalt
<a href="neueseite.htm" onmouseover="einblenden()" onmouseout="ausblenden()">Linktext</a></body></html>
Das funzt in IE ab Version 5, in NN ab Version 6, in Opera ab Version 5 und in Mozilla ab Version 1. In NN4 funktioniert es natürlich nicht (Was funktioniert da schon).