Jump to content

Not sure where to post this or even what it's specifically called...


Recommended Posts

It might be called object mapping, but I'm not sure.  Basically, I'm wanting somewhat of a GUI where the User clicks on an area of the page, and the location of the click is noted (for a database).  From there it can be given a value based on whether or not a right click was used vs a left click.

Here's something to get you started i'd use onmouseclick

 

<html>

<head>

<title>Get Mouse Coordinates</title>

<script language=”javascript”>

var divObj;

 

/**

* capture mousemove event, this statement will cause browser to

* call getMouseCoordites function each time mouse moves

*/

document.onmousemove=getMouseCoordinates;

 

/**

*identify which event is supported

* Based on that collect pageX and pageY properties of the event object

* pageX and pageY gets the X and Y cursor coordinates

*/

function getMouseCoordinates(event)

{

ev = event || window.event;

divObj.innerHTML = “Mouse X:”+ev.pageX + ” Mouse Y:”+ev.pageY;

}

 

//assign the mouseCoord Object to divObj

function loadDiv()

{

divObj = document.getElementById(“mouseCoord”);

}

</script>

</head>

 

<body onLoad=”loadDiv()”>

<div id=”mouseCoord”>Mouse Coordinates position will be displayed here.

</div>

</body>

</html>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.