Hi,

I am trying to implement mouse over popUp in my application, that is working fine in Mozilla but not working in IE.
In IE its position is not coming proper and I am not able to shift it.
To set position of popUp I am using following code:

var offX= -180; // how far from mouse to show tip
var offY= 12;

var mouseX, mouseY;
function trackMouse(evt) {
    standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
    mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
    mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
    if (tipOn) positionTip(evt);
}

function positionTip(evt) {
    if (!tipFollowMouse) {
        mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
        mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
    }
    // tooltip width and height
    var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
    var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
    // document area in view (subtract scrollbar width for ns)
    var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
    var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
    // check mouse position against tip and window dimensions
    // and position the tooltip 
    if ((mouseX+offX+tpWd)>winWd) 
        tipcss.left = mouseX-(tpWd+offX)+"px";
    else tipcss.left = mouseX+offX+"px";
    if ((mouseY+offY+tpHt)>winHt) 
        tipcss.top = winHt-(tpHt+offY)+"px";
    else tipcss.top = mouseY+offY+"px";
    if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

In popUp there is an init method which is loaded on body using <body onLoad=""> tag.
Tanu

masijade commented: This is JavaScript and has nothing to do with either Java or JSP. Next time, please post to the proper forum. -1

Recommended Answers

All 3 Replies

This is an area where there is much incompatibility.

The values pageX and pageY are part of the Mozilla set of properties, not the W3C standard DOM properties. IE doesn't know them.

Fortunately for me (I hate those popups), but unfortunately for everyone else, there is no agreement between IE and Mozilla here. I don't understand why everyone loves these maddening popup devices. They are NOT dyslexic-accessible.

The W3C standard DOM reports the mouse locations with clientX and clientY. The problem is that these do not take document scrolling into account, but just use the browser window location.

Hi,

I am still stucked with the same problem of different responses in IE and mozilla.
I am trying to popUp a Calender on click and that is working fine in mozilla but in IE that is getting transparent.. like Dropdown boxes from the background are coming over the calendar.

I think I need to set z-index for this.. but I am not able to do.
Please help.. if anybody can.
Thanks.
Tanu

The Z index is also not totally implemented yet in a universal way that works on all browsers.

You need to either open an entirely new window (taking focus away from the stuff on the existing window) or make sure where you open the popup has no links under it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.