Jona
06-15-2003, 09:15 PM
Yes, I'm back again. Khalid, I guess you never read any of the replies because you thought Dave had my question covered. He's being secretive. :D The code you posted made my tooltip script work for IE, but now NS, which you said was easy to make it work for too, is giving me problems. I got it as far as appearing the DIV, and working in IE, but as far as it moving in Netscape... No go. All right, so the page is at my testing page (http://geocities.com/god_loves_07/books.html), where you can view it for yourself, and the code I have is below (you'll notice commented out code that I used for testing, I left that in there on purpose):
var t, d, sX, sY, x, y;
function popup(txt, event){
d = document.getElementById("tooltip");
//d.style.top=event.pageY;
sX = (document.documentElement) ? document.documentElement.scrollLeft : 0; //window.innerWidth-event.pageX;
sY = (document.documentElement) ? document.documentElement.scrollTop : 0;
//window.innerHeight-event.pageY
if(navigator.appName!="Netscape"){t=event.srcElement; x=event.x+10+sX; y=event.y+10+sY;}
else{t=event.target; x=event.pageX+10+sX; y=event.pageY+10+sY;}
if(parseInt(navigator.appVersion)<4){return;}else{
d.style.top=y;
d.style.left=x;
d.style.visibility="visible";
d.innerHTML="<p align=justify style=width:240px>"+txt+"</p>";
t.title="";
return true;
} }
function stoppop(event){
d=document.getElementById("tooltip");
d.style.visibility="hidden";
d.innerHTML="";
return true;
}
In the popup() function, I have commented out d.style.top=event.pageY. I have created a small script that, onMouseMove of a DIV, moves another DIV the same place as the mouse (event) and it works with the afforementioned code. But when I tested the code with the afforementioned code, it only appears with the DIV at the top-right corner of the screen (where it is automatically because the position is set to absolute).
Thanks. :D
Jona
var t, d, sX, sY, x, y;
function popup(txt, event){
d = document.getElementById("tooltip");
//d.style.top=event.pageY;
sX = (document.documentElement) ? document.documentElement.scrollLeft : 0; //window.innerWidth-event.pageX;
sY = (document.documentElement) ? document.documentElement.scrollTop : 0;
//window.innerHeight-event.pageY
if(navigator.appName!="Netscape"){t=event.srcElement; x=event.x+10+sX; y=event.y+10+sY;}
else{t=event.target; x=event.pageX+10+sX; y=event.pageY+10+sY;}
if(parseInt(navigator.appVersion)<4){return;}else{
d.style.top=y;
d.style.left=x;
d.style.visibility="visible";
d.innerHTML="<p align=justify style=width:240px>"+txt+"</p>";
t.title="";
return true;
} }
function stoppop(event){
d=document.getElementById("tooltip");
d.style.visibility="hidden";
d.innerHTML="";
return true;
}
In the popup() function, I have commented out d.style.top=event.pageY. I have created a small script that, onMouseMove of a DIV, moves another DIV the same place as the mouse (event) and it works with the afforementioned code. But when I tested the code with the afforementioned code, it only appears with the DIV at the top-right corner of the screen (where it is automatically because the position is set to absolute).
Thanks. :D
Jona