Results 1 to 4 of 4

Thread: Help me

  1. #1
    Join Date
    Jun 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help me

    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.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Because it's event.page(X|Y) in Firefox, not event.client(X|Y).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    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

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Oh, really? I apologise then.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •