How to remove x and y on submit in HTML form with Image type button?

Prashant picture Prashant · Apr 29, 2009 · Viewed 34.6k times · Source

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.com/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.

Answer

Eoin Campbell picture Eoin Campbell · Apr 29, 2009

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;" />