Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change submit button image 1

Status
Not open for further replies.

dom24

Programmer
Aug 5, 2004
218
GB
Does anyone know if it is possible to change the normal sumbit button image to one of my own?

Thanks.
 
try this...
Code:
<INPUT type="IMAGE" value="SUBMIT" src="myImage.gif" width="20" height="10" title="Submit Details" />

Tony
________________________________________________________________________________
 
Yeah that works thanks, but how do I add a mouseover image to that?
 
Here's the function (and some additional javascript) that will do this for you:

Code:
<script language="javascript">
<!--

	if (document.images) {
		var initial = new Image();
		initial.src = 'path/to/orig_image.gif';
		
		var over = new Image();
		over.src = 'path/to/over_image.gif';
	}

	function ChangeImg(id,name){
		document.getElementById(id).src = eval(name + ".src");
	}
-->
</script>

And here's how you would call it:

Code:
<INPUT id="submitter" type="IMAGE" value="SUBMIT" src="path/to/orig_image.gif" title="Submit Details" onmouseover="ChangeImg('submitter','over');" onmouseout="ChangeImg('submitter','initial');" />

*cLFlaVA
----------------------------
Ham and Eggs walks into a bar and asks, "Can I have a beer please?"
The bartender replies, "I'm sorry, we don't serve breakfast.
 
Works a treat. Thanks very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top