Jump to content

Custom submit button


kurt.santo

Recommended Posts

Would like to use a custom submit button (using the following code):

   <form action="#"><input name="email" type="text" /><input name="submit" type="submit" src="content/go.gif"/></form>

, but it still displays the standard button and even places the button underneath the input box (would like to have it next to it). Any ideas?Kurt

Link to comment
Share on other sites

You can have

<form action="#" name="myform"><input name="email" type="text" /><img src="content/go.gif" onclick="document.myform.submit()" /></form>

Basically, anything with onclick can be set to submit the form, just call the submit() method on the form.

Link to comment
Share on other sites

You can have
#competition form	{					height:22px;					padding:0px;					margin:0px;					}				#competition input	{					padding: 0px;					margin: 0px 5px 0px 0px;					vertical-align:top;					}					#competition img	{					padding: 0px;					margin: 0px;					vertical-align:top;					}

Any ideas why images might line up differently to input boxes?Kurt

Link to comment
Share on other sites

You can have
<form action="#" name="myform"><input name="email" type="text" /><img src="content/go.gif" onclick="document.myform.submit()" /></form>

Basically, anything with onclick can be set to submit the form, just call the submit() method on the form.

You don't even need to do that, there's already an image submit button.<input type="image" src="content/go.gif">
Link to comment
Share on other sites

You don't even need to do that, there's already an image submit button.<input type="image" src="content/go.gif">
Justsomeguy, I also tried your given example. But then the go-button is completely disaligned with the text box. Why is that? Would like to have the button vertically in the middle of the text box...Kurt
Link to comment
Share on other sites

You mean it is to the left? Try using text-align:center; on the parent element (e.g. a container div).

Link to comment
Share on other sites

You mean it is to the left? Try using text-align:center; on the parent element (e.g. a container div).
Synook,I mean the vertical alignment. Applied a padding to the left of the input box (button is next to that), so that has been taken care of. It is just that the go button somehow does not want to vertical-align to the middle (meaning the middle of the text box)...Kurt
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...