Category: Programming

Getting Coordinates of a mouse click

Posted by – June 30, 2007

Today I was working on an image editing program, and wanted to determine the x and y coordinates on an image. I knew that imagemaps will give you the coordinates that you clicked on, but I wanted to mimic this behavior in javascript.

It turns out there are 2 ways to do this: If you are using IE (then shame on you!) you can get the coordinates using an offsetX and offsetY.For example, an an onclick handler to your image, passing in the event (ex: <img onclick=’getCoords(e)’ …) then inside the getCoords function, you can use e.offsetX and e.offsetY.

But what If I am awesome, and thus don’t use IE, you might ask. Well, it is only slightly more work. Other browsers give you a pageX and pageY, so you simply have to compare those values with the images values, and do some math to get your coordinates. The image offsets can be found with offsetTop and offsetLeft so to get the x value, you would do:


var xOffset = e.pageX - document.getElementById("thePictureId").offsetLeft

Problem Solved!

phpBB Admin Email Search Mod Version 1.0.1

Posted by – August 14, 2004

Many times a user will contact a board admin saying that they can’t log in. Unfortunately because phpBB’s log in system does not use the email for the log in the user often forgets their username they used on the board.

With a small board it is easy to find the username based on the email, with a larger board it is not.

So this mod adds an admin panel email lookup. Just type in an email and it will show what account name that email is registered to. It also has direct links to view or edit the profile.

The installation is simple, and does not involve any file editing at all. Just upload the files and the email search will appear in the admin panel.

Download the Code

Get Support

phpBB SEO Mod – able2know SEO 2.0.0

Posted by – November 16, 2003

I get so many questions about phpBB search engine optimization that I am finally writing up the definitive mod for this.

Read more at the original phpbb SEO Mod thread on able2know or download the mod.