SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    document.onmousemove problem in iframe

    Hi,
    I have four iframes in my main document. I am trying to get the mouse location in the main doc, it works in the areas where there are no iframe but I don't get it in my iframes.
    Plz hlp..

    Heres the javascript in my main doc

    var IE = document.all?true:false
    if (!IE) document.captureEvents(Event.MOUSEMOVE)
    document.onmousemove = getMouseXY;
    var tempX = 0;
    var tempY = 0;

    function getMouseXY(e) {
    if (IE) {
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
    } else {
    tempX = e.pageX
    tempY = e.pageY
    }

    if (tempX < 0){tempX = 0}
    if (tempY < 0){tempY = 0}

    alert(tempX +" "+tempY);
    }


    I am not an expert in javascript, the above script i got from a site...

    I actually want this alert in whole of my document

    Thanks in advance

  2. #2
    SitePoint Member
    Join Date
    Sep 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I figured it out.....

    I didn't had any idea about how event flows in a document, its interesting.


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
  •