document.onmousemove and <!DOCTYPE html...


D

Defacta

Hi !

I try to make a message appears when the mouse is on an image et this
is working fine:
http://cult.free.fr/test_mouse_on/test_mouse.html

But, if add the following line at the begining of the document, it's
not working anymore with Firefox and whith Safari:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The not working page is here:
http://cult.free.fr/test_mouse_on/test_mouse2.html

It's like these lines:

document.getElementById("ghp_dpp").style.top = y + 30 ;
document.getElementById("ghp_dpp").style.left = x + 30 ;

is not executed anymore, does anyone know what I have to do to make
this script work with the line of the <!DOCTYPE...>

Thanks,
Vincent.
 
Ad

Advertisements

M

Martin Honnen

Defacta said:
But, if add the following line at the begining of the document, it's
not working anymore with Firefox and whith Safari:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The not working page is here:
http://cult.free.fr/test_mouse_on/test_mouse2.html

It's like these lines:

document.getElementById("ghp_dpp").style.top = y + 30 ;
document.getElementById("ghp_dpp").style.left = x + 30 ;

is not executed anymore, does anyone know what I have to do to make
this script work with the line of the <!DOCTYPE...>

Yes, if browsers are in strict mode (and that DOCTYPE triggers strict
mode) then you need to make sure you use valid CSS values and top/left
want a number plus a unit (e.g. px) so use

document.getElementById("ghp_dpp").style.top = y + 30 + 'px';
document.getElementById("ghp_dpp").style.left = x + 30 + 'px';
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top