Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > document.onmousemove and <!DOCTYPE html...

Reply
Thread Tools

document.onmousemove and <!DOCTYPE html...

 
 
Defacta
Guest
Posts: n/a
 
      12-18-2007
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.
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-18-2007
Defacta wrote:

> 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';
--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57