|
|
Using an image as a submit buttonA submit button created using <INPUT TYPE="SUBMIT> is rather a drab looking gray colored entity, unless you know style sheets. For all you designers who have detested this dull button, here is a solution to add color to your HTML forms. The simplest way is to use an image as a submit button employing the <INPUT> HTML form tag. <INPUT TYPE="IMAGE" SRC="butup.gif" ALT="Submit button"> When using this tag, you should remember some important differences between Netscape and Internet Explorer and how they handle this tag.
To overcome such browser incompatibility, I generally use a linked image and a little JavaScript code. The image when clicked submits the form through onClick() JavaScript event handler. Let me share this piece of code with you. <A HREF="javascript:document.myform.submit()" onmouseover="document.myform.sub_but.src='butdown.gif'" onmouseout="document.myform.sub_but.src='butup.gif'" onclick="return val_form_this_page()"> <IMG SRC="butup.gif" WIDTH="143" HEIGHT="39" BORDER="0" ALT="Submit this form" NAME="sub_but"> </A> Click on the image below to see how it works. The JavaScript code is actually quite simple once you break it down.
Page contents: Using an image as a submit button - images as form submit buttons - image mouse roll over
Page URL: http://www.webdevelopersnotes.com/tips/html/ 21.php3
|
|