开发者

Input Image Coordinates Not Working In Chrome

Problem:

I have a page that开发者_JS百科 has a large form, and in the middle of it I have an image as an input. From that image I get the x and y coordinates for where the user clicked, do some calculation, and redirect to a different page. However when I use Google Chrome on this page I find that the x and y coordinates are not posted, and so this form doesn't work.

Question:

Is this typical behavior of Chrome or am I missing something? If it's a validation problem how can I figure out what the culprit is?

Example:

<form action="FORMACTION" name="MyForm" id="MyForm" method="get">
...
    <input type="image" width="600" height="460" name="graphClick" 
        id="graphClick" src="IMAGESOURCE" alt="IMAGENAME" title="TITLETEXT"
        onclick="goToPage('action');">
...
</form>

Note: goToPage is a javascript function to set the action of the form and submit it.


It's impossible to tell without seeing what goToPage() does. But setting the form's action on the onclick event sounds kind of weird, and it wouldn't surprise me if that's the reason for the funny behaviour.

I bet if you set an action the normal way, it'll post x and y coordinates.

Maybe the code executed in goToPage could be attached to the onsubmit event of the form? That may increase the chances of the click positions making it through.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜