Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi folks,

Really i hate Javascript,

I want to get the Position of Button control by javascript for Firefox,

I can get it for Internet Explorer but not in Firefox.

that is my code which work in IE:

JavaScript
var posX    = event.screenX;
var posY    = event.screenY;
Posted
Updated 29-Nov-11 8:43am
v2
Comments
Wonde Tadesse 29-Nov-11 21:03pm    
I think it works for FF as well. Check this out http://www.w3schools.com/js/tryit.asp?filename=try_dom_event_screenxy

1 solution

ok jst in case you need solution for both then i'll say go for jquery and to find position there you'll have offset ie if you want to find positon of any buttion btn

you need this code

var offset = $(btn).offset();

var left=offset.left;
var top=offset.top;

this will work on all browsers.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900