IT Community - Software Programming, Web Development and Technical Support

event.clientX and event.clientY is working in IE but not work in firefox?

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 ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-06-2007, 02:58 AM
senraj senraj is offline
D-Web Master
 
Join Date: Jul 2007
Posts: 418
senraj is on a distinguished road
Post event.clientX and event.clientY is working in IE but not work in firefox?

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.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-08-2007, 04:25 AM
Aritha Aritha is offline
D-Web Trainee
 
Join Date: Aug 2007
Posts: 1
Aritha is on a distinguished road
Default Re: event.clientX and event.clientY is working in IE but not work in firefox?

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;
}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-08-2007, 04:27 AM
vadivelanvaidyanathan vadivelanvaidyanathan is offline
D-Web Genius
 
Join Date: Feb 2007
Posts: 803
vadivelanvaidyanathan is on a distinguished road
Default Re: event.clientX and event.clientY is working in IE but not work in firefox?

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>
__________________
V.Vadivelan

There never a wrong time to do the right thing.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 06:44 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0