Javascript get mouse position

Lmillard
Lmillard used Ask the Experts™
on
Hi,

I am collecting the mouse position on screen using javascript so that I can position a popup box next to the correct text. This is working fine in chrome and explorer but when I use the same script in mozilla the menu just appears in the top left corner of the screen.

I am only using the following simple code with offset being a value passed to the function which is normally the width of the box so that it positions correctly.

I am a total javascript novice so this could be completly wrong, any help is appreciated.

Cheers
Leigh


function showTypemenu(Typeid,taskid,offset) {
    $('#menubox').load(httppath+'taskmanager/GetTaskType.cfm?Typeid='+escape(Typeid)+'&taskid='+escape(taskid))
	document.getElementById('menubox').style.visibility = 'visible';
	document.getElementById('menubox').style.height = 'auto';
	document.getElementById('menubox').style.left = (window.event.clientX - offset) + 'px';
	document.getElementById('menubox').style.top = (window.event.clientY + 15) + 'px';
}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial