Hangman -- JS
by IcyFlame
HTML
<table>
<tr><td>Score:</td><td id="score">0</td></tr>
<tr><td>Attempts remaining:</td><td id="attrem">7</td></tr>
<tr><td>Word:</td><td id="toguess"></td></tr>
<tr><td>Letter:</td><td><input type="text" maxlength="1" id="letter" onkeyup="verify()"/></td></tr>
</table>
<button onclick="verify()">Go</button>
<button onclick="gen()">New Game</button>
<p id="resp"></p>
<!--I know that using tables is not the best practise. But it just seemed convenient coz I wanna do this just to get the hang of it!-->
JavaScript
//Initialising some basic variables.
score = 0;
attrem = 7;
listOfWords = ['about', 'after', 'again', 'air', 'all', 'along', 'also', 'an', 'and', 'another', 'any', 'are', 'around', 'as', 'at', 'away', 'back', 'be', 'because', 'been', 'before', 'below', 'between', 'both', 'but', 'by', 'came', 'can', 'come', 'could', 'day', 'did', 'different', 'do', 'does', "don't", 'down', 'each', 'end', 'even', 'every', 'few', 'find', 'first', 'for', 'found', 'from', 'get', 'give', 'go', 'good', 'great', 'had', 'has', 'have', 'he', 'help', 'her', 'here', 'him', 'his', 'home', 'house', 'how', 'I', 'if', 'in', 'into', 'is', 'it', 'its', 'just', 'know', 'large', 'last', 'left', 'like', 'line', 'little', 'long', 'look', 'made', 'make', 'man', 'many', 'may', 'me', 'men', 'might', 'more', 'most', 'Mr.', 'must', 'my', 'name', 'never', 'new', 'next', 'no', 'not', 'now', 'number', 'of', 'off', 'old', 'on', 'one', 'only', 'or', 'other', 'our', 'out', 'over', 'own', 'part', 'people', 'place', 'put', 'read', 'right', 'said', 'same', 'saw', 'say', 'see', 'she', 'should', 'show', 'small', 'so', 'some', 'something', 'sound', 'still', 'such', 'take', 'tell', 'than', 'that', 'the', 'them', 'then', 'there', 'these', 'they', 'thing', 'think', 'this', 'those', 'thought', 'three', 'through', 'time', 'to', 'together', 'too', 'two', 'under', 'up', 'us', 'use', 'very', 'want', 'water', 'way', 'we', 'well', 'went', 'were', 'what', 'when', 'where', 'which', 'while', 'who', 'why', 'will', 'with', 'word', 'work', 'world', 'would', 'write', 'year', 'you', 'your', 'wa']
ag = new Array();
gai = new Array();
word = '';
wordIs = '';
function IN(a, b) {
for (i = 0; i < b.length; i++)
if (b[i] == a)
return true;
return false;
}
function update() {
document.getElementById("toguess").innerHTML = word;
document.getElementById("attrem").innerHTML = attrem;
document.getElementById("score").innerHTML = score;
document.getElementById("letter").value =...