This is a discussion on event.clientX and event.clientY is working in IE but not work in firefox? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; I am not able to get the clientX (or pageX), clientY(or PageY) values in the event. It is working ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| I am not able to get the clientX (or pageX), clientY(or PageY) values in the event. It is working fine in IE but in MozillaFirefox , clientX and clientY are not in event. Last edited by senraj : 08-06-2007 at 04:45 AM. |
| Sponsored Links |
| |||
| Use this script var isOpera, isIE, isNav, isFox, isOther = false; if (navigator.userAgent.indexOf("Opera")!=-1) { isOpera = true; } else if (navigator.userAgent.indexOf("Firefox")!=-1) { isFox = true; } else if (navigator.appName == "Microsoft Internet Explorer") { isIE = true; } else if (navigator.appName == "Netscape") { isNav = true; } else { isOther = true; } if (isIE) { OffsetX = window.event.offsetX; OffsetY = window.event.offsetY; } else { OffsetX = e.pageX - document.getElementById("divImage").offsetLeft; OffsetY = e.pageY - document.getElementById("divImage").offsetTop; } |
| |||
| You need to supply the event, this is predefined but needs to be explicit, so I've made it a function parameter. Try this: <html> <head> <title>Event</title> <script> function openwin(url,x,y,nam,event) { var nwin = window.open(url,nam,"resizable=0, menubar=0, status=0, toolbar=0, directories=0, location=0, scrollbars=1") nwin.resizeTo(x, y); var posy = event.clientY; var posx = event.clientX; nwin.moveTo(posx,posy); } </script> </head> <body onClick="openwin('somepage.htm',100,100,'childWin' ,event)"> </body> </html> |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mouse event | varghese | HTML, CSS and Javascript Coding Techniques | 1 | 09-18-2007 07:31 AM |
| Event Calendar [ ASP.NET 2.0 / C# ] | Sundaram | ASP and ASP.NET Programming | 11 | 09-10-2007 07:08 AM |
| Window event | Kamalakannan | HTML, CSS and Javascript Coding Techniques | 1 | 07-30-2007 03:21 AM |
| event bubbling | sivakumar | ASP and ASP.NET Programming | 1 | 07-16-2007 11:36 PM |
| Equivalent DOM event in firefox browser for onpaste() | Jeyaseelansarc | HTML, CSS and Javascript Coding Techniques | 2 | 05-09-2007 12:19 AM |