Link to home
Start Free TrialLog in
Avatar of Lmillard
Lmillard

asked on

Javascript get mouse position

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

ASKER CERTIFIED SOLUTION
Avatar of markis3
markis3

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial