JavaScript - I don't see anything obvious that is wrong
function Flip() {
var Probability = Math.floor(Math.random());
if (Probability > 0.5) {
document.getElementById("message").innerHTML("Heads!");
}
if (Probability < 0.5) {
document.getElementById("message").innerHTML("Tails!");
}
HTML - Nothing should be wrong in the HTML (besides selectors)
<body>
<button onClick="Flip()" id="submit">FLIP THE COIN</button>
<p id="message"></p>
</body>
Aucun commentaire:
Enregistrer un commentaire