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!

INPUT type="image"

Status
Not open for further replies.

MENON

Programmer
Jul 23, 2001
28
US
I am having some problems with graphical submit buttons.

1. It seems that graphical buttons have to be last tag in the FORM element. Is this TRUE??? Has anyone experienced any problems with graphical submit buttons?

2. If I replace all SUBMIT buttons with graphical submit buttons, do I have to use <A>and <IMG> tags for regular buttons
viz... <input type=button name=back onclick=window.history.back()>
with graphics HAS TO become
<a href=&quot;#&quot; onclick=window.history.back()><img src=&quot;button.gif&quot; alt=back> </a>
Is there any other alternative?

Your inputs will be highly appreciated.

Thanks
Rakesh
 
I always just use a mouseover function to replace images...mouseover buttons are obselete. Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Hello Anthony,

I didn't quite understand your response. Could you probably send me code snippet.
for eg. if I need to replace following code
<FORM action=2.html method=post>
<INPUT TYPE=submit value=submit name=advance>
</FORM>

to work with graphics, how will I implement the IMG tag to have submit functionality?

Thanks,
Rakesh

 
Oh crud...sorry, I'm a little sleepy, going on about 27 hours now...*yawn*...I forgot about the submit property...usually I use an image and say, on click I ran a javascript function (or did I...I remember I think I did)...anyhow, test that out...if onclick works with an image...you could swap out the images like a lot of people do for mouseovers, etc...I dont remember exactly how to do it, but I could find out if ya need. Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
what about:
Code:
<input type=&quot;image&quot; src=&quot;/button.gif&quot; name=&quot;mybutton&quot;>
This creates a &quot;submit button&quot; with the image. When clicked on it submits the form, and passes the coordinates of the mouse on the image as the value of the button (which you can ignore).
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I am crunchy, and good with mustard. Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
I've never used it, but it's there in the HTML4.0 spec. For all I know, one or the other of NN or IE doesn't even support it, but it's been around for a while, so it ought to work.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Well, he mentioned he was having problems with the image buttons...so I was trying to think of a workaround...

And the image buttons are pretty much obselete...but usable all the same...is there any way in javascript to call the submit function?...like

document.all('formname').submit?...if there is, I could find a workaround in no time. Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Hi,

To answer WhiteTiger:

document.name_of_forn.submit();

Bye.
 
You should use

document.getElementById(&quot;formname&quot;).submit();

so that you are using the DOM standard.

Although you can also use

document.forms[&quot;formname&quot;].submit();

and I believe that is part of the ECMA262 standard. ===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
The problem with using the DOM standard getElementById is that it isn't supported in the older browsers, and there are still quite a few of those around. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Yay, now I'm sure he could work with an IMAGE that called those functions...=)...I know they have imageswaps out there and stuff like that...so now, if you do a form submit in there...custom buttons galore!...see, I KNEW I was onto something...(Yea....right...LOL) Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Hi All,

Thanks for your suggestions. I finally did end up using <IMG> tags with <A> tags and using document.[&quot;formname&quot;].submit() in the onclick event of <A> tag.

Thanks a lot.

Regards,
Rakesh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top