document.onmousemove and <!DOCTYPE html...

Discussion in 'Javascript' started by Defacta, Dec 18, 2007.

  1. Defacta

    Defacta Guest

    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.
     
    Defacta, Dec 18, 2007
    #1
    1. Advertising

  2. 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/
     
    Martin Honnen, Dec 18, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Defacta
    Replies:
    3
    Views:
    475
    Beauregard T. Shagnasty
    Dec 18, 2007
  2. Gary Mayor
    Replies:
    0
    Views:
    241
    Gary Mayor
    Mar 3, 2004
  3. Gary Mayor
    Replies:
    3
    Views:
    277
    Rob Swindells
    Mar 4, 2004
  4. Mariusz

    ondragstart and onmousemove messages

    Mariusz, Dec 14, 2004, in forum: Javascript
    Replies:
    2
    Views:
    139
    Mariusz
    Dec 15, 2004
  5. Larry Lindstrom
    Replies:
    19
    Views:
    1,308
    Jonathan N. Little
    Jun 12, 2012
Loading...

Share This Page