473,385 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Making a reset button that reset a javascript if/else statement answer

1
I made an If/Else statement that would tell if 10 equaled 5 and it would give the answer. I was wondering if i could make a reset to reset the answer given.

heres my code

Expand|Select|Wrap|Line Numbers
  1. html
  2. <!DOCTYPE html> <html> <body> </form> 
  3. <p>Click the button:</p> 
  4. <button onclick="myFunction()">Try it</button> <p id="demo"></p>
  5.  
  6. JS
  7. function myFunction() {
  8.     var greeting;
  9.     if (10 == 10){
  10.         greeting = "Yes";
  11.     } else {
  12.         greeting = "No";
  13.     }
  14.     document.getElementById("demo").innerHTML = greeting;
  15. }
Oct 16 '14 #1
1 1312
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

Yes, you can do that. You do it the same way you did for the Try it button. Except you just leave out the if stuff.
Oct 16 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matt | last post by:
i need to implement a clear button to clear all the fields in the form, but i am thinking i can just use reset button. <input type="reset" name="reset" value="CLEAR"> The first thought is...
4
by: Chris Lane | last post by:
Hi, I have an HTML RESET button and Web Control Button that posts back to the server. Problem is the reset button doesn't work after the postback occurs. Any ideas or suggestions as to why this...
2
by: angus | last post by:
Dear All, I have to implement a reset button in the web form. i think that i can use the web component(button) to get the fired onclick event on the reset button. after the postback, the...
1
by: NancyASAP | last post by:
Thought I'd share this since it took me a long time to get it working. Thanks to a bunch of contributers in Google Groups who shared javascript, etc. The question was: How can I put a reset...
7
by: Kermit Piper | last post by:
Hello, How can you clear session variables when a reset button is pressed? I thought I might be able to do something like: <% If request.form("Reset") = "Reset" then Session("variable") =...
16
by: Animesh K | last post by:
What's the best practice for using an image for a reset button? Unfortunately, we cannot use <input type="image" src="..."in this case. Any helpful tutorial from the web will be appreciated. I...
3
by: computerkid101 | last post by:
Hey everyone, I am making an online quiz (school project) and basically I have 4 radio buttons (the options; multiple choice) and then an answer button. What I want is for the user to answer and...
5
by: Monomita Har | last post by:
I have a form where I use some field validations which shows messages if getting errors or corrects.At bottom there is a reset button to reset all previously input data and javascript messages...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.