使用FireFox中的图像按钮形成mailto问题& Chrome附加x = y =

时间:2011-06-16 18:14:10

标签: forms firefox google-chrome imagebutton mailto

当我在FireFox或Chrome中使用带有表单图像按钮的mailto时,我将“x = 101 y = 15”类型文本添加到正文文本的末尾。 x& y值每次都不同。

常规提交按钮正常工作。 IE(一次)做对了。

我的代码有问题吗?

以下示例包含常规提交按钮和图像按钮。

<form action="mailto:example@gmail.com?subject=my subject line&body=my body text" method="post" enctype="text/plain">
<input type="submit" value="Thank you.">
<input type="image" src="image1.png"  onmouseover="this.src='image2.png';"   onmouseout="this.src='image1.png';" alt="Submit"> 
</form>

3 个答案:

答案 0 :(得分:1)

此行为是设计使然。

当用户点击图片按钮时,浏览器会将他点击的坐标发送到服务器。

答案 1 :(得分:1)

谢谢你们。我使用 BUTTON 标记解决方案以避免x = y =问题 - 但必须使用CSS来隐藏默认按钮:

<form action="mailto:example@gmail.com?subject=my subject line&body=my body text" method="post" enctype="text/plain"  >
<button type="submit" style= "background-color:#ffffff; border:0px; margin:0px;">
<img src="image1.png" onmouseover="this.src='image2.png';" onmouseout="this.src='image1.png';" alt=""/>
</button>
</form>

答案 2 :(得分:0)

来自w3 specs

  

带有TYPE=IMAGE' specifies an image resource to display, and allows input of two form fields: the x and y coordinate of a pixel chosen from the image. The names of the fields are the name of the field with的INPUT元素.x'和.y' appended. TYPE = IMAGE'表示`TYPE = SUBMIT'   处理;也就是说,当一个像素是   选择,形式作为一个整体   提交。

在您的情况下,或许在IE中正常工作,但不是预期的。