I wrote simple JavaScript code that allows people to enter a number, and it must return FizzBuzz, Fizz, Buzz, or just a number if it does not meet the conditions of the game FizzBuzz. Then I tried to create a button in HTML with the following code:
<button onclick="fBCalc(prompt("Enter a number!"))">FizzBuzz</button>
I also tried this:
<input type="button" name="FizzBuzz" value="FizzBuzz" onClick="fBCalc(prompt("Enter a number!"))" />
Both methods do not work. I searched google for an answer, but I tried them and nothing happens when I click a button. I made sure that the function was called correctly. This works without a button, so I don’t know why it should not work with a button. If the button cannot request oo Does anyone know what is wrong?
Here is the pastebin for my full HTML code: http://pastebin.com/YPGdbTVQ
source
share