473,769 Members | 4,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 20 '05 #1
3 7634
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 20 '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.off setX,event.offs etY);
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**********@y oucant.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 20 '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.off setX,event.offs etY); 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.infosystem s.www.authoring.* at all.

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

Jul 20 '05 #4

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

Similar topics

3
2593
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" onblur=document.cookie="user=" + box1.value> Chris
4
21301
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. http://validator.w3.org/check?uri=http://www-thaihydro.geog.cam.ac.uk/riverslice/&ss=1&verbose=1 (e.g. see line 77) suggests that it is valid, but the spec suggests that it is not. More detail:
5
13124
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 tried to eliminate it several ways, but it won't go away. It looks like it's forcing at least one space (line break?) in after each field, and then there's some mystery padding on the right that also refuses to go away. I've put up a demo of...
3
13156
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 this, with a flush left margin:
3
12936
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 type=submit value='Done'> </form>
4
18435
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 advance, Rick
2
3386
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 field(s). The popping-up seems to work just fine; it's the tearing down that's giving me grief. If I stick a onmouseout event on the same input field that caused the onmouseover/pop-up, it starts to flicker 'cos the <divis placed for esthetically...
2
3289
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 itself, where it checks the values that were entered. If the default values are set, this is the visitor's first time to access the page. Example: The FirstName field would initially be displayed with "First Name;"
1
2537
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 have to view all students under the certain subject and at the last field, I putted a form to put the scores of each student. say '<input type=text name='score' size=10>' and number of '<input type=text>' is equal to the number of students. I...
1
5508
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
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7409
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.