This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Reset Button

 
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to add a gif onto a HTML page which will act as a reset button for a form. i know how to make a standard reset button but don't know how to add this funtionality to a GIF, can anyone help?
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try to use form.reset() method for your img events?
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How I would I write that? That is what would an example line of code look? I'm really new to javascript and havn't got a clue!!
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Angela,
I prepared a small html file which has a form, in which there are some input fields and instead of RESET button an image is taken from the current directory. When you click on that image the fields will be reset. I used JavaScript to do that. Also I purposly inclided 'spaces' inside all html tags in order to prevent this forum interpret them. So please edit them back when u use them.
regds
maha anna
<pre>
< HTML >
< HEAD >
< TITLE >Duke< /TITLE >
< /HEAD >
< BODY >
< script >
< !--<br /> function clearForm(){<br /> document.LayoutForm.reset();<br /> }<br /> //-- >
< /script >
< FORM NAME="LayoutForm" ACTION="" METHOD=POST >
< TABLE >
< TR >
< TD >< P >FirstName< /TD >
< TD >< P >< INPUT TYPE=TEXT NAME="FormsEditField1" VALUE="" SIZE=9 MAXLENGTH=10 >�< /TD >
< /TR >
< TR >
< TD >< P >Age< /TD >
< TD >< P >< INPUT TYPE=TEXT NAME="FormsEditField2" VALUE="" SIZE=9 MAXLENGTH=10 >�< /TD >
< /TR >
< TR ALIGN=CENTER >
< !-- < TD COLSPAN=2 >< P >< IMG ID="Picture1" HEIGHT=68 WIDTH=55 SRC="duke.gif" lang="javascript" onclick="clearForm()" >�< /TD > -->
< TD COLSPAN=2 >< P >< IMG HEIGHT=68 WIDTH=55 SRC="duke.gif" lang="javascript" onclick="clearForm()" > < /TD >

< /TR >
< /TABLE >
< /FORM >
< /BODY >
< /HTML >
</pre>

[This message has been edited by maha anna (edited April 15, 2000).]
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot, I'll give that a try!!!
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried it but I get an error on the page.
Thanks anyway!!
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What error do you get? I verified . It works fine for me. When you click on the image the 2 input fields will be reset.
regds
maha anna
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I get a notice in the staus bar saying error on page when I click on the image. It seems to be having a problem with the line with the < IMG > tag.
I've removed the spaces and can't see anything else obvious.
 
Jane Rozen
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Angela, what browser you are using?
If it's Netscape, just type "javascript:" next to "Location:" sign(where you are entering URLs)and press "enter". You will see so-called Javascript console window, and it will show the exact source of your error. Try it.
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Angela,
I have edited the above file shown in my previous post. Now the 'RED' colour line has NO ID field. Try in this way. Otherwise instead of lang="javascript" try language = "javascript". The minimum fields needed for an image to show are 'src' and 'width' and 'height'. Try and change these fields as necessary. You will definitely succeed.
regds
maha anna
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brilliant, it works thanks!!!
Unfortunatly all the time it took to try to sort it out meant that the reset button was removed from the page by my boss, who now regrets it cos it would have made things alot better , but deadlines to meet and all that!
Never mind at least I'll know for next time, thank you
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is all fine for me. But I have an additional problem. I have a submit button and a reset button. I can implement the reset button as specified above. But the mouse behaves differently when it is over the submit button and when it is over the reset button. Any ideas on how to solve this will be helpful
Rahul
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rahul,
Use an image for the submit button also:
<img src="aaa.gif" onClick="document.formName.submit();">
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
I am not able to use the reset button as specified.
I have tried the code that is written above but it gives me the error that
object does not support this property or method.
I am using IE 6.0.
While I try to open the page in mozilla firefox 1.5.0.3 it is not giving me any error while I click the image but nothing happens i.e. it does not reset anything.

Thanks and Regards,
Prashant Deshani
reply
    Bookmark Topic Watch Topic
  • New Topic