By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,704 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,704 IT Pros & Developers. It's quick & easy.

LayerX in IE???

P: 16
Hi,

I have the following code, which run popup widow. In Mozilla this work OK, I have problems in IE. The popup window appears on the top of my window not near my mouse cursor.

I think I don't use event.offsetX or event.offsetY correctly....



Expand|Select|Wrap|Line Numbers
  1. var tooltip = document.createElement('div'); 
  2.  
  3. document.getElementById("mydiv").appendChild(tooltip);  
  4.  
  5. var ie5 = (document.getElementById && document.all); 
  6. var ns6 = (document.getElementById && !document.all); 
  7.  
  8. if(document.getElementById)
  9. {
  10.  
  11.             mousex = (ie5)?event.offsetX:(ns6)? e.layerX:false;
  12.             mousey = (ie5)?event.offsetY:(ns6)? e.layerY:false; 
  13.  
  14.                 tooltip.style.left =( mousex+12 ) + 'px';
  15.                tooltip.style.top = (mousey+8) + 'px';
  16. }
  17.  
Thanks in advance:)
Feb 16 '07 #1
Share this Question
Share on Google+
1 Reply

acoder
Expert Mod 15k+
P: 16,027
The correct way to detect mouse co-ordinates is described at the bottom of this page.
Feb 17 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.