PDA

View Full Version : JS Button


kungfoore
11-15-2002, 07:30 PM
I am trying to display a submit type button, but instead of using the typical grey lame-looking button, I want to add a JPEG.

Here's the code for the button and input field in question:

<INPUT TYPE="text" size=30 maxlength=60 NAME="SearchText">&nbsp;<INPUT TYPE="submit" VALUE="Search the site">

Thanks!

A1ien51
11-15-2002, 07:40 PM
well you can use css and make the backgound the image of the jpg.

or you can do this

<img src="TheFile.jpg" onclick="document.formname.submit()">

or
<a href="javascript:document.formname.submit()"><img src="TheFile.jpg"></a>

beetle
11-15-2002, 07:58 PM
Any input that is type="image" will submit it's form when clicked (e.g. It IS a submit button)

<input type="image" src="TheFile.jpg" />

Although Alien51's suggestions will work, this is the preferred method

cg9com
11-15-2002, 08:48 PM
for further reference:http://javascriptkit.com/howto/button2.shtml