如何使用图像类型按钮在HTML表单中提交x和y?

编程入门 行业动态 更新时间:2024-10-27 16:33:53
本文介绍了如何使用图像类型按钮在HTML表单中提交x和y?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

< form action =/ search /method = 搞定 > < input id =search-boxname =searchtype =textsize = 30 title =Searchvalue =/> < input id =search-submittype =imagealt =Searchsrc =/ images / search-button.gif/> < / form>

但是当我提交我的表单时,URL将被创建为如下所示:

mysitename/search/?search=hello&x=0&y=0

任何人都可以告诉我为什么这个x和y会出现在我的URL中。

< form action =更多的事情,而不是图像按钮,如果我改变我的表单代码, / search /method =get> < input id =search-boxname =searchtype =textsize = 30 title =Searchvalue =/> < input id =search-submittype =submitvalue =Search/> < / form>

但我需要一个图片按钮才能让我的表单看起来不错。请告诉我如何从URL中删除这些x和y参数。

提交按钮类型=图像

您可以使用标准的提交类型按钮,只需对其应用样式即可更改外观。

< input type =submitid =search-submitvalue = style =background-image:url(/ images / search-button.gif); border:solid 0px#000000; width:WIDTHpx; height:HEIGHTpx; />

I have created a form in my application as follows:

<form action="/search/" method="get"> <input id="search-box" name="search" type="text" size=30 title="Search" value="" /> <input id="search-submit" type="image" alt="Search" src="/images/search-button.gif" /> </form>

But when I am submitting my form then URL is created as below:

mysitename/search/?search=hello&x=0&y=0

Can anyone please tell me why this x and y is coming in my URL. On more thing instead of image button if I am changing my form code as below then its working fine,

<form action="/search/" method="get"> <input id="search-box" name="search" type="text" size=30 title="Search" value="" /> <input id="search-submit" type="submit" value="Search"/> </form>

but I need an image button to make my form look good. Please tell me how to remove these x and y parameteres from URL.

解决方案

You'll always get mouse co-ordinates for a submit button type="image"

You can use a standard submit type button and just apply styles to it to change the look.

<input type="submit" id="search-submit" value="" style="background-image: url(/images/search-button.gif); border: solid 0px #000000; width: WIDTHpx; height: HEIGHTpx;" />

更多推荐

如何使用图像类型按钮在HTML表单中提交x和y?

本文发布于:2023-10-11 13:55:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1481889.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   如何使用   按钮   图像   类型

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!