Forum Moderators: open
i've been trying to solve this problem for the past couple of days. I have an image submit button so that when a user clicks the image the coordinates of the clicking are sent, ie, in a map i click on London and the coordinates of London are sent. What im trying to do now is sending the coordinates automatically through Javascript without clicking the image. i tryed to do document.forms[0].submit() but the coordinates it sends are (1,1). How can i send other coordinates through Javascript?
Thanks in advance
<input type="hidden" id="secretHidden" value="" />
<input type="image" onclick="javascript:catchme(event);">
function catchme(evt)
{
if (!evt) var evt = window.event;
alert("Mouse X: " + evt.clientX + "\nMouse Y: " + evt.clientY);
document.getElementById("secretHidden").value = evt.clientX.concat(",") + evt.clientY;
}
- i want to pass the coordinates (posLeft/posTop properties) automatically, without clicking the image. i have predefined coordinates where i want to go, so i dont need to click the image, just send the coordinates through javascript.