SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: input type="image" ??
Hybrid View
-
Oct 21, 2001, 08:31 #1
- Join Date
- Feb 2001
- Location
- England
- Posts
- 352
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
input type="image" ??
Hello
when using the input type image like so...
<input type="image" value="url" name="url" alt="url" src="../../images/admin/url.gif">
is it only possible to use it with submit, ie can it be made to do other button functions like reset or none (for a customised button)??
thanks in advance
a+
Garrett
-
Oct 21, 2001, 09:07 #2
Sure you can. Just put an onclick event on the input type="image" like this example (it will reset your form):
onclick="javascript:document.forms[0].reset();"
but be aware: it will also do a submit if you defined an action in the form tag. So you will have to add your own submit code to another button.
-
Oct 21, 2001, 10:20 #3
- Join Date
- Feb 2001
- Location
- England
- Posts
- 352
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
>Lbut be aware: it will also do a submit if you >defined an action in the form tag. So you will have >to add your own submit code to another button.
thats what i was thinking, the other annoying thing is that its writes submit to the status bar even when its not going to be a submit and there seems to be no way to stop this from happening.
a+
Garrett
-
Oct 21, 2001, 13:40 #4
But if you want to use an image as a button, don't use the input type="image". Just make a <img> a put an onclick event on that image. Then you can do anything you want (submit, reset, form validation or whatever...)
-
Oct 21, 2001, 16:07 #5
- Join Date
- Feb 2001
- Location
- England
- Posts
- 352
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
good idea, did'nt think of that!! thats what i'll do as it will fix both problems for me.
Thanks!
Garrett
Bookmarks