Hangman Script Tutorialpage eight |
|
More of this FeaturePage One Page Two Page Three Page Four Page Five Page Six Page Seven
document.write('<div
class="hangb">');
if (win == 0) availLetter(); else if (win == 4) document.write('<div class="hangt">YOU WIN<br \/><a else document.write('<div class="hangt">YOU LOSE<br \/><a document.write('<div align="center"> <br \/><img displayAnswer(); document.write('<\/div>'); This final piece of code is what runs all of the other functions. If the game hasn't finished it calls the availLetter function to display the letters that are still available for the next guess. If the game is over it displays whether the game was won or lost followed by a link allowing the person to run the game again. Under this is displayed an image indicating the current status of the game. The game uses eleven images to represent the gradual addition of body parts to the hangman as up to ten wrong guesses are made. Finally below that the displayAnswer function is called to display the answer field with dashes showing where letters remain to be guessed. |

