I need help with my function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Blue1244
    New Member
    • Aug 2013
    • 39

    I need help with my function

    It doesn't want to give the "correct" alert box. It always gives me the
    Code:
    confirm("Incorrect");
    .


    Code:
    <!DOCTYPE hmtl>
    <html>
    <head>
    <style>
    #button2 {
    	display: none;
    }
    </style>
    </head>
    <script>
    function displayTwo()
    {
    document.GetElementbyId(button2).style.display="block";
    }
    </script>
    <script>
    function start()
    {
    var one = prompt("What is 3 * 4 ?");
     
     
    if (one!=12)
      {
     
        alert("Correct!");
    	
     
      }
    else
     {
     
        var x= confirm("Incorrect! Restart?");
    	if (x==true)
    	{
    		location.reload();
    	}
    	else
    	{
    		location.reload();
    	}
     }
    
    }
     
    </script>
    <script type="text/JavaScript">
    var Name = prompt("What is your name?");
    </script>
     
    <script type="text/JavaScript">
    document.write(Name);
    </script>
     
    <center><button id="button1" onClick="start(); displayTwo()">First Question</button></center>
    <center><button id="button2" onClick="two()">Second Question</button></center>
     
    </html>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    look closely at what you have written:

    IF variable IS NOT 12 THEN correct

    Comment

    • Blue1244
      New Member
      • Aug 2013
      • 39

      #3
      Oh I feel stupid :| lol thank you for letting me know my mistake, Mistakes are what i learn from.

      Comment

      • Blue1244
        New Member
        • Aug 2013
        • 39

        #4
        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.

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          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.

          Comment

          • Blue1244
            New Member
            • Aug 2013
            • 39

            #6
            I'm trying to learn, because i really want to be a person who codes for a living.

            Comment

            Working...