<FORM NAME="WordForm">
<INPUT TYPE=TEXT NAME="WordBox" id="wordbox"><BR>
<INPUT id="button" TYPE=BUTTON VALUE="Generate" onClick="PickRandomWord(document.WordForm);">
<script>
var NumberOfWords = 3
var words = new BuildArray(NumberOfWords)
// Use the following variables to
// define your random words:
words[1] = "M _ T _"
words[2] = "F _ _ T _ _ L _"
words[3] = "K _ Y _ _ A _ _"
function BuildArray(size) {
this.length = size
for (var i = 1; i <= size; i++) {
this[i] = null
}
return this
}
function PickRandomWord(frm) {
button.style.visibility = "hidden";
var rnd = Math.ceil(Math.random() * NumberOfWords)
frm.WordBox.value = words[rnd]
}
</script>
<div>
<label for="name" style="color:purple; background-color:rgb(223, 247, 10)" style="font-family:verdana">Guess the
word in CAPITAL letters</label>
<input type="text" name="Enter_the_word" id="Enter_the_word" placeholder="Enter_the_word" required><br>
<br>
<button type="submit" style="background-color: blue; color: yellow" onclick="myFunction()">NEXT LEVEL</button>
</div>
I am making this word game, The user has three chances in each level After he generates the word in the first level and doesn't get the word correct and moves on to guess-2 of Level 1 the word should not generate again instead the word should remain the same, that is the word in the first guess. So that the three guesses in each level have the same word in it. The word should only be generated in the first guess and the word should remain the same in the second and third guess.
THANK YOU
Aucun commentaire:
Enregistrer un commentaire