Forum Moderators: phranque

Message Too Old, No Replies

using image as submit with GET method

         

drooh

9:07 pm on May 28, 2009 (gmt 0)

10+ Year Member



<input id="search_button" src="/img/search.jpg" type="image" name="sub" value="Enter" />

I am using the method="get"

and for some reason this is appearing in the address bar
&sub.x=61&sub.y=27&sub=Enter

why is there a sub.x and a sub.y ?

This is only happening when i use an image as submit button

Do i need to assign a width and height attribute to my input?

phranque

9:41 pm on May 28, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



[w3.org...]

drooh

9:58 pm on May 28, 2009 (gmt 0)

10+ Year Member



ok, so is there a way to remove that sub.x and sub.y ?

It sounds like i may need to use an image with some javascript?

rocknbil

12:11 am on May 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't need to do any of that. Stick with what will work if Javascript is disabled:

<style type="text/css">
#search_button {
background: url(/img/search.jpg) top left no-repeat;
}
</style>

<input type="submit" id="search_button" name="sub" value="Enter">

You may have to fiddle with the width, height, borders, padding, etc. via CSS, may have to set value="", but this will work (personally you're better off letting value do it's thing and remove text from the image . . . your call.)