...

View Full Version : adding a image inplace of a sumit button



jimmyp3016
12-31-2003, 10:34 PM
I was wondering how to ad an image i have instead of the default submit button in this code. short amount of code dont worry. Any help would be great thanks!

<form>
<p>
<input type="text" name="text2">
</p>
<p>
<input type="password" name="text1">
<input type="button" value="Check In" name="Submit"
onclick=javascript:validate(text2.value,"free",text1.value,"javascript") >
</p>

</form>
<script language = "javascript">

function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load('success.htm');
else
{
load('failure.htm');
}
}
function load(url)
{
location.href=url;
}
</script>

justame
01-01-2004, 12:12 AM
jim...
just a try® this kinda coding...
<INPUT TYPE="image" value="subscribe" SRC="whatever.jpg">

sooo yourrr....
<input type="button" value="Check In" name="Submit"
onclick=java script:validate(text2.value,"free",text1.value,"javascript") >


twould just a become®...

<INPUT TYPE="image" SRC="whatever.jpg" value="Check In" name="Submit"
onclick=java script:validate(text2.value,"free",text1.value,"javascript") >

just a goodluck® n' welcome to the forum...:O)))

Vladdy
01-01-2004, 01:31 AM
try
<button><img....></button>

oh and your validation should actually be:
<form onsubmit="return validateForm()" ....

benleegt
01-01-2004, 03:42 AM
Try using <a href="#"><img border="0" src="put the submit image" width="?" height="?" onClick="(form name).submit();"></a>

brothercake
01-01-2004, 03:54 AM
what justame said

benleegt
01-01-2004, 04:07 AM
No, mine's shorter

Willy Duitt
01-01-2004, 05:06 AM
<a href="#"><img border="0" src="put the submit image" width="?" height="?" onClick="(form name).submit();"></a>

This brings to mind a recent discussion I had
regarding using an image as an anchor.

Is the above correct HTML?
Or, is ISMAP required when using an image in this context?

.....Willy

brothercake
01-01-2004, 05:53 AM
Originally posted by benleegt
No, mine's shorter
Yes, but yours is wrong - the <a> serves no purpose, and for those who don't have javascript the form won't be submitted at all.

What justame posted is the semantic HTML method for using an image as a <form> submit button.

Willy Duitt
01-01-2004, 06:08 AM
Originally posted by Willy Duitt
This brings to mind a recent discussion I had
regarding using an image as an anchor.

Is the above correct HTML?
Or, is ISMAP required when using an image in this context?

.....Willy

Oooh;

Let me rephrase my question.
Is this correct usage?

<a href="http://google.com"><img src="image.gif" width="?" height="?" alt="Google Link"></a>

Or, is ISMAP required to be semanticaly correct?

.....Willy

brothercake
01-01-2004, 07:44 AM
Sorry .. I was only talking to benleegt in my other response.

Yes, that's fine. In fact ISMAP is very old - used only for server-side image maps; for client-side image maps you use USEMAP to refer to a <map>. But what you have there is just a single image link - no need for a map unless you want the image to have more than one linked hotspot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum