PDA

View Full Version : Help me



QSDangKhoa
06-13-2006, 09:22 AM
1. In Javascript I want to use event object to get coordinate of cursor and show a tooltip box when the cursor point to one position. Here is my code:

function Show(e)
{
var x,y;
if(document.all)
{
x=event.clientX;
y=event.clientY;
if(x>500)x=600;
if(mclick)
{
frm.imgmh.src=mcurrImage;
frm.imgmh.style.left=x;
frm.imgmh.style.top=y;
frm.imgmh.style.display='';
frm.imgmh.style.zindex=2;
}
}
else
{
x=e.clientX;
y=e.clientY;
if(x>500)x=600;
if(mclick)
{
document.frm.imgmh.src=mcurrImage;//getElementById('imgmh')
document.frm.imgmh.style.offsetLeft=x;
document.frm.imgmh.style.offsetTop=y;
document.frm.imgmh.style.display='';
document.frm.imgmh.style.zindex=2;
}
}
}

IE is OK. But in firfox, the tooltip box is showed but can't move with cursor. It's placed a fix position.
Please help me!

2. I create 1 table, in there I name an ID for a TD tag is 'PQContent' to change the content of this TD. Here's my code:
document.getElementById('PQContent').innerHTML="<FONT FACE=arial SIZE=2>"+cont+"</FONT>";

In IE is OK, but in firefox, i can't change the content.
Please help me.

Thank you very much.

Twey
06-13-2006, 01:14 PM
Because it's event.page(X|Y) in Firefox, not event.client(X|Y).

mwinter
06-13-2006, 10:23 PM
Because it's event.page(X|Y) in Firefox, not event.client(X|Y).Not true. The clientX/Y and screenX/Y properties of the event object are defined in the W3C DOM Event specification (though Gecko-based browsers do also provide pageX/Y properties).

The OP is welcome to provide a link to a demonstration.

Mike

Twey
06-14-2006, 05:40 AM
Oh, really? I apologise then.