Help - Search - Members - Calendar
Full Version: Input (type=image) tag, forms, and image maps
HTMLHelp Forums > Programming > Client-side Scripting
gordonsowner
Hi,

I have an image that is the src of an input tag, and that input tag is wrapped in a form tag. Normally, I can click on this image and the img.x and img.y coordinates are passed to a new page. However, along with sending this info, I want to overlay an image map that i use to trigger tooltips. I get the tooltip and, with an onClick attribute defined in the area tag of the map tag for the image map, I can trigger the form to submit when clicked.

However, I loose the img.x and img.y attributes that were passed when i didn't overlay the image with an image map. I need these coordinates. Can someone tell me how to use a form/input(type=image) with an image map and still be able to submit the form with the coordinates clicked on the input tag's image?

thanks,
gordonsowner
mike007
QUOTE(gordonsowner @ Feb 13 2008, 12:03 AM) *

Hi,

I have an image that is the src of an input tag, and that input tag is wrapped in a form tag. Normally, I can click on this image and the img.x and img.y coordinates are passed to a new page. However, along with sending this info, I want to overlay an image map that i use to trigger tooltips. I get the tooltip and, with an onClick attribute defined in the area tag of the map tag for the image map, I can trigger the form to submit when clicked.

However, I loose the img.x and img.y attributes that were passed when i didn't overlay the image with an image map. I need these coordinates. Can someone tell me how to use a form/input(type=image) with an image map and still be able to submit the form with the coordinates clicked on the input tag's image?

thanks,
gordonsowner


I use the <button></button> tag in a form when I want a image as background of my button. With this tag you dont need the x/y coordinates. You can ccs style this. This is a better solution cause it works in any browser. your solution will have lotsa problem in IE.

greets

http://www.finishedwebsites.nl
Darin McGrew
The button element is useless when JavaScript is disabled/unsupported. Normal submit buttons are more reliable.

For the original poster, AFAIK, there is no a way to combine the usability of a client-side image map with the delivery of x-y coordinates of a server-side image map or of a graphical submit button.
bendecko
It can be done!

http://www.howtocreate.co.uk/tutorials/html/imagemaps
Darin McGrew
bendecko, that page talks about client-side image maps and server-side image maps, but it doesn't talk about what gordonsowner asked for: a client-side image map that delivers x-y coordinates like a server-side image map.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.