By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,084 Members | 1,969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,084 IT Pros & Developers. It's quick & easy.

I need help with my function

Blue1244
P: 39
It doesn't want to give the "correct" alert box. It always gives me the
Expand|Select|Wrap|Line Numbers
  1. confirm("Incorrect");
.


Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE hmtl>
  2. <html>
  3. <head>
  4. <style>
  5. #button2 {
  6.     display: none;
  7. }
  8. </style>
  9. </head>
  10. <script>
  11. function displayTwo()
  12. {
  13. document.GetElementbyId(button2).style.display="block";
  14. }
  15. </script>
  16. <script>
  17. function start()
  18. {
  19. var one = prompt("What is 3 * 4 ?");
  20.  
  21.  
  22. if (one!=12)
  23.   {
  24.  
  25.     alert("Correct!");
  26.  
  27.  
  28.   }
  29. else
  30.  {
  31.  
  32.     var x= confirm("Incorrect! Restart?");
  33.     if (x==true)
  34.     {
  35.         location.reload();
  36.     }
  37.     else
  38.     {
  39.         location.reload();
  40.     }
  41.  }
  42.  
  43. }
  44.  
  45. </script>
  46. <script type="text/JavaScript">
  47. var Name = prompt("What is your name?");
  48. </script>
  49.  
  50. <script type="text/JavaScript">
  51. document.write(Name);
  52. </script>
  53.  
  54. <center><button id="button1" onClick="start(); displayTwo()">First Question</button></center>
  55. <center><button id="button2" onClick="two()">Second Question</button></center>
  56.  
  57. </html>
  58.  
Aug 22 '13 #1

✓ answered by Dormilich

look closely at what you have written:

IF variable IS NOT 12 THEN correct

Share this Question
Share on Google+
5 Replies


Dormilich
Expert Mod 5K+
P: 8,639
look closely at what you have written:

IF variable IS NOT 12 THEN correct
Aug 22 '13 #2

Blue1244
P: 39
Oh I feel stupid :| lol thank you for letting me know my mistake, Mistakes are what i learn from.
Aug 22 '13 #3

Blue1244
P: 39
I might be asking questions a lot I'm still trying to learn and you reply to everything so sorry if I start to annoy you. Most of them might make me look blonde though.
Aug 22 '13 #4

Dormilich
Expert Mod 5K+
P: 8,639
so sorry if I start to annoy you.
that’s nothing. I’ve seen worse from people either unwilling to learn or unable to read.
Aug 23 '13 #5

Blue1244
P: 39
I'm trying to learn, because i really want to be a person who codes for a living.
Aug 24 '13 #6

Post your reply

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