[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 958
  • Last Modified:

input type="image": removing X and Y


When I use
   <input type="image">
instead of
   <input type="submit">
I get "x" and "y" automatically appended to my search query.  It seems to pass on the coordinates of the image I clicked on.  

I don't want this.

Is there a way to prevent "x" and "y" from being passed?

<form method="get" action="search.cgi">
<input type="text" name="search" size="10" value="search">
<input type="image" src="images/search.gif" alt="Search">

Open in new window

2 Solutions
How about submitting this way:
<form method="get" action="search.cgi" id="searchform">
<input type="text" name="search" size="10" value="search">
<img src="images/search.gif" onclick="javascript:getElementById('searchform').submit();" alt="Search">

Open in new window

Göran AnderssonCommented:
> Is there a way to prevent "x" and "y" from being passed?

No, that's the purpose of the image button.

You could use a regular submit button and put the image on it using css:

<input type="submit" style="background:url(images/search.gif);width:100px;height25px;border:none;" title="Search">

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now