点击图片,获取坐标 [英] Click an image, get coordinates
问题描述
我知道这是可以做到的,我甚至对如何做到这一点有一个模糊的想法,但它停止了模糊。
我有一个标准的HTML图像标记其中有一个图像,大小为100×100像素。我希望人们能够点击图像,并将它们点击的X和Y传递给一个函数。
坐标需要相对于图像
预先感谢您的帮助。 解决方案
我认为你在谈论:
< input id =infotype =image>
提交时,x和y坐标的表单值基于输入元素id( info.x
和 info.y
在这种情况下)。
http://www.w3。 org / TR / REC-html40 / interact / forms.html#h-17.4.1
I know it can be done and I even have a vague idea of how to do it but it stops at being vague.
I have a standard HTML image tag with an image in it, 100 by 100 pixels in size. I want people to be able to click the image and for that to pass the X and Y that they click into a function.
The coordinates need to be relative to the image top and left.
Thank you in advance for any help.
I think you're talking about:
<input id="info" type="image">
When submitted, there are form values for the x and y coordinate based on the input element id (info.x
and info.y
in this case).
http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4.1
这篇关于点击图片,获取坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!