473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

getting at <input type=image ...> coordinates

When I click on the image form element
<INPUT type=image name=point src="map.png">
point.x and point.y values get submitted to the server
specifying where on the image I have clicked.

Is there any (simple) way to get ahold of that point.x and
point.y BEFORE they are sent to the server (and prevent
that from happening)? Ie. I just want the points where
someone clicks on an image and not interested in a submission
to the server.

Thanks,
Csaba Gabor
Jul 23 '05 #1
3 2319
What are you trying to do exactly? What do you plan to do with the x and y
values? Would an imagemap on the image not suffice?

Let us know.
Stu
Jul 23 '05 #2
Hi Stu. I want to mark two points on a map (so I can zoom in to a
subportion,
or not zoom, but select all the interesting items). So I'd like to get the
coordinates
first and just stuff them into some edit fields so the user can adjust them.
Also, having written a poor man's immediate fix version below that only
works
for IE, I can see that I'll also want to have the current position show in a
div.

My current hack:
<input type=image name=mymap onclick="return mapClick();">

and the script does:
function mapClick() {
document.forms[0]['pt'].value = Array(event.offsetX,event.offsetY);
return false;
}
I'm interested in the original question on a theoretical basis, but my
immediate interest is more practical in that the app is for my own editing
purposes.
I suspect you're correct that there are other ways to do this, and I'd
love to hear - my current knowledge of images/maps could stand bolstering.
I'm not sure I understand how to capture mouse coordinates with a
client side image map, though.

Csaba

"Stuart Palmer" <tr**********@youcant.com> wrote in message
news:2i************@uni-berlin.de...
What are you trying to do exactly? What do you plan to do with the x and y
values? Would an imagemap on the image not suffice?

Let us know.
Stu

Jul 23 '05 #3
"Csaba Gabor" <Cs***@z6.com> wrote:
Hi Stu.
Please spend some time in learning how to post to Usenet:
http://www.cs.tut.fi/~jkorpela/usenet/dont.html
Followups trimmed. Since you question was about JavaScript, not HTML, you
should have posted to the JavaScript group only.
I want to mark two points on a map (so I can zoom in to a
subportion,
Actually, I think you probably need a server-side script
My current hack:
<input type=image name=mymap onclick="return mapClick();">

and the script does:
function mapClick() {
document.forms[0]['pt'].value =
Array(event.offsetX,event.offsetY); return false;
}
So you had the answer, but you didn't bother telling it in the original
question.
I'm interested in the original question on a theoretical basis,
What question? Your JavaScript code prevents form submission when the
image is clicked on, provided that JavaScript is enabled. What "theory"
do you need in addition to that? Did you seriously expect to be able to
do such things in HTML, or what?

If you are unhappy with your own solution, consider explaining what is
your problem with it.
my immediate interest is more practical in that the app is for my own
editing purposes.


So it didn't really belong to comp.infosystems.www.authoring.* at all.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: chirs | last post by:
Hi, I want to put a value in a cookie. The following code does not work. It does not store the box1.value in the cookie. How can I fix it? <input type="text" name="box1"...
4
by: Martin Lucas-Smith | last post by:
I am wanting to know whether are XHTML1-valid characters for use within an id attribute and/or a name attribute. ...
5
by: Jonathan Daggar | last post by:
Hello, I'm trying to put together a form with a very tight table formatting. However, every time I put an text-type input field in, the browser pads the area to the right of it with space. I've...
3
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like...
3
by: Ben | last post by:
Here's my form: <form name="aForm" method='post'> <input type=file name=file1 onkeypress='KeyPress()'><br> <a id='attachMoreLink' href='javascript:AddFileInput()">Attach More Files </a> <input...
4
by: Rick | last post by:
I'm trying to make an input tag visible or hidden based on the value of another input tag, so that when the 1st input tag is changed in anyway, the 2nd input tag will become visible. Thanks in...
2
by: Richard Maher | last post by:
Hi, I'm trying to use the Visibility Style attribute for a Div to effectively PopUp a lightweight window with some additional context-sensitive information, when a user mouses over a given...
2
by: jp2code | last post by:
I have several input fields on my form, and the form works; however, Visual Studio is showing errors, and I would like to get rid of them. When the form is submitted, it is redirected back to...
1
by: JPhilS | last post by:
Hi to all Webmaster! I have discover this problem when I inserted the scores of the students i a centain subject. I am making a school project with regards to saving students' record. first, I...
1
by: test9991014 | last post by:
Hi folks, I've got something like this: <table> <tr> <td>1</td> <td align=center> <input type=text> </td>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.