473,883 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

hangman game confused about code

4 New Member
I am not able to figure out how to make this work.
I am trying to create a hangman game. I am in a basic javascripting class.
I am to only use very basic code as you can see. I am able to use any online resources to help me.
I have added alot of comments for what should be happening however is not happening.
I also have a teacher that teaches us one way but then asks us to do things he has not taught. I am trying my very best.

Any help is greatly appreciated!


[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Hangma n</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" language="JavaS cript">

var NumberOfChances ;
var theWord = "";
var currentGuessed = "";

//Array of 50 secret words
var words = new Array();
words[0]="computer";
words[1]="electronic ";
words[2]="negative";
words[3]="positive";
words[4]="ambassador ";
words[5]="dictionary ";
words[6]="maintain";
words[7]="responsibl e";
words[8]="adventure" ;
words[9]="sunshine";
words[10]="friendship ";
words[11]="attention" ;
words[12]="surgery";
words[13]="genealogy" ;
words[14]="investment ";
words[15]="mathematic s";
words[16]="journey";
words[17]="interest";
words[18]="moment";
words[19]="military";
words[20]="developmen t";
words[21]="enjoyment" ;
words[22]="encouragement ";
words[23]="hygiene";
words[24]="enlistment ";
words[25]="hyphenatio n";
words[26]="orientatio n";
words[27]="references ";
words[28]="highlight" ;
words[29]="recipients ";
words[30]="envelopes" ;
words[31]="preview";
words[32]="translatio n";
words[33]="research";
words[34]="grammar";
words[35]="thumbnails ";
words[36]="document";
words[37]="position";
words[38]="window";
words[39]="conversation" ;
words[40]="recommendatio ns";
words[41]="experience ";
words[42]="reference" ;
words[43]="failure";
words[44]="dignity";
words[45]="faithfulness" ;
words[46]="recklessness" ;
words[47]="leftovers" ;
words[48]="remainder" ;
words[49]="difficulty ";
words[50]="boxes";



//hangman series of images
var image = new Array();
image[0] = '<img src="images/image0.jpg" align ="left" width="415" height="496">';
image[1] = '<img src="images/image1.jpg" align ="left" width="415" height="496">';
image[2] = '<img src="images/image2.jpg" align ="left" width="415" height="496">';
image[3] = '<img src="images/image3.jpg" align ="left" width="415" height="496">';
image[4] = '<img src="images/image4.jpg" align ="left" width="415" height="496">';
image[5] = '<img src="images/image5.jpg" align ="left" width="415" height="496">';
image[6] = '<img src="images/image6.jpg" align ="left" width="415" height="496">';
document.getEle mentById('Image ').innerHTML = '<img src = "Image' + count + '.jpg" />';
NumberOfChances = image.length;


//swap the images for the hangman, start with image[0], then replace the image with each wrong guess, 6 chances
function swap(image)
{
var content=documen t.getElementByI d("imgID"+image ).src;

}
// an array to store the letters guessed if i can not figure out how to disable onclick of letters in form,
//want to highlight them red to so the player sees that they already choose that letter
var usedLetters = new Array();

for (i=0; i<letterguessed ; i++)



// creating the random pick of the secret word out of 50 choices
function secretWord()
{
theWord = words[Math.floor(Math .random()*51)];
for (i=0; i<theWord.lengt h; i++)
{
currentGuessed = currentGuessed + "*";
}
}

//the process that starts the game and resets it when the player chooses to play again
function gameProcess()
{
currentGuessed ="";
secretWord();
NumberOfChances =0;
startImage = image[0];
while (NumberOfChance s<7)
{
// not here move somewhere
onload= "gameProces s()" //
turn();

}

}


//this is what happens when the player takes a turn
function turn(letterGues sed)
{
var correctGuess = False;
for (i=0; i<theWord.lengt h; i++)
{
if (theWord[i] == letterGuessed)
{
currentGuessed[i] = letterGuessed;
correctGuess=Tr ue;
}

}
if (!correctGuess)
{
NumberOfChances ++;
if (NumberOfChance s==7)
{
alert("You Lost!")
}
if(correctGuess != 0)
{
takeChance();
}
win();

}

}

function win()
{
var winCount = 0;
for(var i = 0;i<word.length ;i++)
{
if(wordDisplay[i] == "*")
{
winCount++;
}
}
if(winCount == 0)
{
document.write( "yay, you win!");
}
}

</script>
</head>

<body>
<!--need to use Div tags -->
<H1> Hang De Clown</H1>
<!--hangman pic displaying first image, need to swap images with each wrong guess -->

<div id=Image><img src='images/image0.jpg' align ="left" width="415" height="496"></div>
<div id="wordDisplay "></div>

<!-- form for guessing letter,display secret word, display number of guesses left, restart, end game -->
<form name="userGuess Form">
This is the Secret Word<br /><input id="secretWord " type=text value="currentG uessed" />
<br />
<input id="letters" type="button" name="a" value="a" onClick="turn(' a');"><!-- as player guess wrong letter change to red and make unusable so player can not choose the letter again-->
<input id="letters" type="button" name="b" value="b" onClick="turn(' b');">
<input id="letters" type="button" name="c" value="c" onClick="turn(' c');">
<input id="letters" type="button" name="d" value="d" onClick="turn(' d');">
<input id="letters" type="button" name="e" value="e" onClick="turn(' e');">
<input id="letters" type="button" name="f" value="f" onClick="turn(' f');">
<input id="letters" type="button" name="g" value="g" onClick="turn(' g');">
<input id="letters" type="button" name="h" value="h" onClick="turn(' h');">
<input id="letters" type="button" name="i" value="i" onClick="turn(' i');">
<input id="letters" type="button" name="j" value="j" onClick="turn(' j');">
<input id="letters" type="button" name="k" value="k" onClick="turn(' k');">
<input id="letters" type="button" name="l" value="l" onClick="turn(' l');">
<input id="letters" type="button" name="m" value="m" onClick="turn(' m');">
<input id="letters" type="button" name="n" value="n" onClick="turn(' n');">
<input id="letters" type="button" name="o" value="o" onClick="turn(' o');">
<input id="letters" type="button" name="p" value="p" onClick="turn(' p');">
<input id="letters" type="button" name="q" value="q" onClick="turn(' q');">
<input id="letters" type="button" name="r" value="r" onClick="turn(' r');">
<input id="letters" type="button" name="s" value="s" onClick="turn(' s');">
<input id="letters" type="button" name="t" value="t" onClick="turn(' t');">
<input id="letters" type="button" name="u" value="u" onClick="turn(' u');">
<input id="letters" type="button" name="v" value="v" onClick="turn(' v');">
<input id="letters" type="button" name="w" value="w" onClick="turn(' w');">
<input id="letters" type="button" name="x" value="x" onClick="turn(' x');">
<input id="letters" type="button" name="y" value="y" onClick="turn(' y');">
<input id="letters" type="button" name="z" value="z" onClick="turn(' Z');"><br />
Number of Tries (6): <input id="lives" type="text" value="0" onfocus="lives. blur();" SIZE=2>
<input type="button" name="submit" value=" Start Over " onClick="gamePr ocess()">
<input type="button" name="end" value=" END " onClick="gameEn d()"><br />


</form>

<p>&nbsp;</p>
<H2>Direction s</H2>
Please guess a letter to see if you figure out the secret word.<br />
You will have 6 chances to guess the word, or guess a letter.<br />
If you guess incorrectly you will lose a chance and your clown will be one step closer to being hung!<br />
Good Luck!

</body>
</html>[/HTML]
Mar 12 '08 #1
2 4040
vee10
141 New Member
Hi ,
i have solved ur problem u can change any thing according to ur requirement
if any doubts post


Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Hangman</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <script type="text/javascript" language="JavaScript">
  7.  
  8. var NumberOfChances;
  9. var theWord = "",oldString="";
  10. var currentGuessed = "";
  11. var value="";
  12. //Array of 50 secret words
  13. var words = new Array();
  14. words[0]="computer";
  15. words[1]="electronic";
  16. words[2]="negative";
  17. words[3]="positive";
  18. words[4]="ambassador";
  19. words[5]="dictionary";
  20. words[6]="maintain";
  21. words[7]="responsible";
  22. words[8]="adventure";
  23. words[9]="sunshine";
  24. words[10]="friendship";
  25. words[11]="attention";
  26. words[12]="surgery";
  27. words[13]="genealogy";
  28. words[14]="investment";
  29. words[15]="mathematics";
  30. words[16]="journey";
  31. words[17]="interest";
  32. words[18]="moment";
  33. words[19]="military";
  34. words[20]="development";
  35. words[21]="enjoyment";
  36. words[22]="encouragement";
  37. words[23]="hygiene";
  38. words[24]="enlistment";
  39. words[25]="hyphenation";
  40. words[26]="orientation";
  41. words[27]="references";
  42. words[28]="highlight";
  43. words[29]="recipients";
  44. words[30]="envelopes";
  45. words[31]="preview";
  46. words[32]="translation";
  47. words[33]="research";
  48. words[34]="grammar";
  49. words[35]="thumbnails";
  50. words[36]="document";
  51. words[37]="position";
  52. words[38]="window";
  53. words[39]="conversation";
  54. words[40]="recommendations";
  55. words[41]="experience";
  56. words[42]="reference";
  57. words[43]="failure";
  58. words[44]="dignity";
  59. words[45]="faithfulness";
  60. words[46]="recklessness";
  61. words[47]="leftovers";
  62. words[48]="remainder";
  63. words[49]="difficulty";
  64. words[50]="boxes";
  65.  
  66.  
  67.  
  68. //hangman series of images
  69. var image = new Array();
  70. image[0] = '<img src="image0.jpg" align ="left" width="415" height="496">';
  71. image[1] = "<img src='image1.jpg' align ='left' width='415' height='496'>";
  72. image[2] = '<img src="image2.jpg" align ="left" width="415" height="496">';
  73. image[3] = '<img src="image3.jpg" align ="left" width="415" height="496">';
  74. image[4] = '<img src="image4.jpg" align ="left" width="415" height="496">';
  75. image[5] = '<img src="image5.jpg" align ="left" width="415" height="496">';
  76. image[6] = '<img src="image6.jpg" align ="left" width="415" height="496">';
  77. //document.getElementById('Image').innerHTML = '<img src = "Image' + count + '.jpg" />';
  78. NumberOfChances = image.length;
  79.  
  80.  
  81. //swap the images for the hangman, start with image[0], then replace the image with each wrong guess, 6 chances
  82. function swap(image)
  83. {
  84. document.getElementById("images").src =image+".gif";
  85.  
  86. }
  87. // an array to store the letters guessed if i can not figure out how to disable onclick of letters in form,
  88. //want to highlight them red to so the player sees that they already choose that letter
  89. var usedLetters = new Array();
  90.  
  91. //for (i=0; i<letterguessed; i++)
  92.  
  93.  
  94.  
  95. // creating the random pick of the secret word out of 50 choices 
  96. function secretWord()
  97. {
  98. debugger
  99. theWord = words[Math.floor(Math.random()*51)]; 
  100. for (i=0; i<theWord.length; i++)
  101. {
  102. currentGuessed = currentGuessed + "*";
  103.  
  104. }
  105. document.getElementById("secretWord").value = currentGuessed;
  106. debugger
  107. }
  108.  
  109. //the process that starts the game and resets it when the player chooses to play again 
  110. function gameProcess()
  111. {
  112. currentGuessed ="";
  113. secretWord();
  114. NumberOfChances=0;
  115. document.getElementById("lives").value = NumberOfChances;
  116. startImage = image[0];
  117.  
  118.  
  119. //this is what happens when the player takes a turn 
  120. function turn(letterGuessed)
  121. {
  122. debugger
  123. value = oldString = "";
  124. var correctGuess = false;
  125. for (i=0; i<theWord.length; i++)
  126. {
  127.  
  128. if (theWord.charAt(i) == letterGuessed)
  129. {
  130. value  = value + letterGuessed;
  131. currentGuessed = currentGuessed.replace(oldString + "*",value);
  132. oldString = value;
  133. correctGuess=true;
  134. }
  135. else
  136. {
  137. if(currentGuessed.charAt(i) == "*")
  138. {
  139. value = value + '*';
  140. oldString = oldString + "*";
  141. }
  142. else
  143. {
  144. value = value + currentGuessed.charAt(i);
  145. oldString = oldString + currentGuessed.charAt(i);
  146. }
  147. }
  148. if (!correctGuess)
  149. {
  150. NumberOfChances++;
  151. swap("image" + NumberOfChances );
  152. if (NumberOfChances==6)
  153. {
  154. alert("You Lost!");
  155. document.getElementById("secretWord").value = theWord;
  156. theWord = "";
  157. currentGuessed = "";
  158. }
  159. document.getElementById("lives").value = NumberOfChances;
  160. if(correctGuess != 0)
  161. {
  162. takeChance();
  163. }
  164. }
  165. win();
  166. }
  167.  
  168. function win()
  169. {
  170.  
  171. var winCount = 0;
  172. for(var i = 0;i<theWord.length;i++)
  173. {
  174. if(currentGuessed.charAt(i) == "*")
  175. {
  176. winCount++;
  177. }
  178. document.getElementById("secretWord").value = currentGuessed;
  179. }
  180. if(winCount == 0 && currentGuessed != "")
  181. {
  182. alert("yay, you win!");
  183. }
  184.  
  185.  
  186. </script>
  187. </head>
  188.  
  189. <body>
  190. <!--need to use Div tags --> 
  191. <H1> Hang De Clown</H1>
  192. <!--hangman pic displaying first image, need to swap images with each wrong guess -->
  193.  
  194.  
  195. <!-- form for guessing letter,display secret word, display number of guesses left, restart, end game -->
  196. <form name="userGuessForm"  id="form1">
  197. <div id="Image"><img src="image0.gif" align ="left" width="415" height="496" id="images"/></div>
  198. <div id="wordDisplay"></div>
  199.  
  200. This is the Secret Word<br /><input id="secretWord" type="text" value="currentGuessed" />
  201. <br />
  202. <input id="letters" type="button" name="a" value="a" onClick="turn('a');"><!-- as player guess wrong letter change to red and make unusable so player can not choose the letter again-->
  203. <input id="Button1" type="button" name="b" value="b" onClick="turn('b');">
  204. <input id="Button2" type="button" name="c" value="c" onClick="turn('c');">
  205. <input id="Button3" type="button" name="d" value="d" onClick="turn('d');">
  206. <input id="Button4" type="button" name="e" value="e" onClick="turn('e');">
  207. <input id="Button5" type="button" name="f" value="f" onClick="turn('f');">
  208. <input id="Button6" type="button" name="g" value="g" onClick="turn('g');">
  209. <input id="Button7" type="button" name="h" value="h" onClick="turn('h');">
  210. <input id="Button8" type="button" name="i" value="i" onClick="turn('i');">
  211. <input id="Button9" type="button" name="j" value="j" onClick="turn('j');">
  212. <input id="Button10" type="button" name="k" value="k" onClick="turn('k');">
  213. <input id="Button11" type="button" name="l" value="l" onClick="turn('l');">
  214. <input id="Button12" type="button" name="m" value="m" onClick="turn('m');">
  215. <input id="Button13" type="button" name="n" value="n" onClick="turn('n');">
  216. <input id="Button14" type="button" name="o" value="o" onClick="turn('o');">
  217. <input id="Button15" type="button" name="p" value="p" onClick="turn('p');">
  218. <input id="Button16" type="button" name="q" value="q" onClick="turn('q');">
  219. <input id="Button17" type="button" name="r" value="r" onClick="turn('r');">
  220. <input id="Button18" type="button" name="s" value="s" onClick="turn('s');">
  221. <input id="Button19" type="button" name="t" value="t" onClick="turn('t');">
  222. <input id="Button20" type="button" name="u" value="u" onClick="turn('u');">
  223. <input id="Button21" type="button" name="v" value="v" onClick="turn('v');">
  224. <input id="Button22" type="button" name="w" value="w" onClick="turn('w');">
  225. <input id="Button23" type="button" name="x" value="x" onClick="turn('x');">
  226. <input id="Button24" type="button" name="y" value="y" onClick="turn('y');">
  227. <input id="Button25" type="button" name="z" value="z" onClick="turn('Z');"><br />
  228. Number of Tries (6): <input id="lives" type="text" value="0" onfocus="lives.blur();" SIZE=2> 
  229. <input type="button" name="submit" value=" Start Over " onClick="gameProcess()">
  230. <input type="button" name="end" value=" END " onClick="gameEnd()"><br />
  231.  
  232.  
  233. </form>
  234.  
  235. <p>&nbsp;</p>
  236. <H2>Directions</H2>
  237. Please guess a letter to see if you figure out the secret word.<br />
  238. You will have 6 chances to guess the word, or guess a letter.<br />
  239. If you guess incorrectly you will lose a chance and your clown will be one step closer to being hung!<br />
  240. Good Luck! 
  241.  
  242. </body>
  243. </html>
  244.  
  245.  
  246.  
Mar 12 '08 #2
tesa
4 New Member
Thank you very much! The program is working great, there is one problem and that is that the images are not swapping.

It is a weird thing that you don't even have to have HTML to take this course.



Hi ,
i have solved ur problem u can change any thing according to ur requirement
if any doubts post


Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Hangman</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <script type="text/javascript" language="JavaScript">
  7.  
  8. var NumberOfChances;
  9. var theWord = "",oldString="";
  10. var currentGuessed = "";
  11. var value="";
  12. //Array of 50 secret words
  13. var words = new Array();
  14. words[0]="computer";
  15. words[1]="electronic";
  16. words[2]="negative";
  17. words[3]="positive";
  18. words[4]="ambassador";
  19. words[5]="dictionary";
  20. words[6]="maintain";
  21. words[7]="responsible";
  22. words[8]="adventure";
  23. words[9]="sunshine";
  24. words[10]="friendship";
  25. words[11]="attention";
  26. words[12]="surgery";
  27. words[13]="genealogy";
  28. words[14]="investment";
  29. words[15]="mathematics";
  30. words[16]="journey";
  31. words[17]="interest";
  32. words[18]="moment";
  33. words[19]="military";
  34. words[20]="development";
  35. words[21]="enjoyment";
  36. words[22]="encouragement";
  37. words[23]="hygiene";
  38. words[24]="enlistment";
  39. words[25]="hyphenation";
  40. words[26]="orientation";
  41. words[27]="references";
  42. words[28]="highlight";
  43. words[29]="recipients";
  44. words[30]="envelopes";
  45. words[31]="preview";
  46. words[32]="translation";
  47. words[33]="research";
  48. words[34]="grammar";
  49. words[35]="thumbnails";
  50. words[36]="document";
  51. words[37]="position";
  52. words[38]="window";
  53. words[39]="conversation";
  54. words[40]="recommendations";
  55. words[41]="experience";
  56. words[42]="reference";
  57. words[43]="failure";
  58. words[44]="dignity";
  59. words[45]="faithfulness";
  60. words[46]="recklessness";
  61. words[47]="leftovers";
  62. words[48]="remainder";
  63. words[49]="difficulty";
  64. words[50]="boxes";
  65.  
  66.  
  67.  
  68. //hangman series of images
  69. var image = new Array();
  70. image[0] = '<img src="image0.jpg" align ="left" width="415" height="496">';
  71. image[1] = "<img src='image1.jpg' align ='left' width='415' height='496'>";
  72. image[2] = '<img src="image2.jpg" align ="left" width="415" height="496">';
  73. image[3] = '<img src="image3.jpg" align ="left" width="415" height="496">';
  74. image[4] = '<img src="image4.jpg" align ="left" width="415" height="496">';
  75. image[5] = '<img src="image5.jpg" align ="left" width="415" height="496">';
  76. image[6] = '<img src="image6.jpg" align ="left" width="415" height="496">';
  77. //document.getElementById('Image').innerHTML = '<img src = "Image' + count + '.jpg" />';
  78. NumberOfChances = image.length;
  79.  
  80.  
  81. //swap the images for the hangman, start with image[0], then replace the image with each wrong guess, 6 chances
  82. function swap(image)
  83. {
  84. document.getElementById("images").src =image+".gif";
  85.  
  86. }
  87. // an array to store the letters guessed if i can not figure out how to disable onclick of letters in form,
  88. //want to highlight them red to so the player sees that they already choose that letter
  89. var usedLetters = new Array();
  90.  
  91. //for (i=0; i<letterguessed; i++)
  92.  
  93.  
  94.  
  95. // creating the random pick of the secret word out of 50 choices 
  96. function secretWord()
  97. {
  98. debugger
  99. theWord = words[Math.floor(Math.random()*51)]; 
  100. for (i=0; i<theWord.length; i++)
  101. {
  102. currentGuessed = currentGuessed + "*";
  103.  
  104. }
  105. document.getElementById("secretWord").value = currentGuessed;
  106. debugger
  107. }
  108.  
  109. //the process that starts the game and resets it when the player chooses to play again 
  110. function gameProcess()
  111. {
  112. currentGuessed ="";
  113. secretWord();
  114. NumberOfChances=0;
  115. document.getElementById("lives").value = NumberOfChances;
  116. startImage = image[0];
  117.  
  118.  
  119. //this is what happens when the player takes a turn 
  120. function turn(letterGuessed)
  121. {
  122. debugger
  123. value = oldString = "";
  124. var correctGuess = false;
  125. for (i=0; i<theWord.length; i++)
  126. {
  127.  
  128. if (theWord.charAt(i) == letterGuessed)
  129. {
  130. value  = value + letterGuessed;
  131. currentGuessed = currentGuessed.replace(oldString + "*",value);
  132. oldString = value;
  133. correctGuess=true;
  134. }
  135. else
  136. {
  137. if(currentGuessed.charAt(i) == "*")
  138. {
  139. value = value + '*';
  140. oldString = oldString + "*";
  141. }
  142. else
  143. {
  144. value = value + currentGuessed.charAt(i);
  145. oldString = oldString + currentGuessed.charAt(i);
  146. }
  147. }
  148. if (!correctGuess)
  149. {
  150. NumberOfChances++;
  151. swap("image" + NumberOfChances );
  152. if (NumberOfChances==6)
  153. {
  154. alert("You Lost!");
  155. document.getElementById("secretWord").value = theWord;
  156. theWord = "";
  157. currentGuessed = "";
  158. }
  159. document.getElementById("lives").value = NumberOfChances;
  160. if(correctGuess != 0)
  161. {
  162. takeChance();
  163. }
  164. }
  165. win();
  166. }
  167.  
  168. function win()
  169. {
  170.  
  171. var winCount = 0;
  172. for(var i = 0;i<theWord.length;i++)
  173. {
  174. if(currentGuessed.charAt(i) == "*")
  175. {
  176. winCount++;
  177. }
  178. document.getElementById("secretWord").value = currentGuessed;
  179. }
  180. if(winCount == 0 && currentGuessed != "")
  181. {
  182. alert("yay, you win!");
  183. }
  184.  
  185.  
  186. </script>
  187. </head>
  188.  
  189. <body>
  190. <!--need to use Div tags --> 
  191. <H1> Hang De Clown</H1>
  192. <!--hangman pic displaying first image, need to swap images with each wrong guess -->
  193.  
  194.  
  195. <!-- form for guessing letter,display secret word, display number of guesses left, restart, end game -->
  196. <form name="userGuessForm"  id="form1">
  197. <div id="Image"><img src="image0.gif" align ="left" width="415" height="496" id="images"/></div>
  198. <div id="wordDisplay"></div>
  199.  
  200. This is the Secret Word<br /><input id="secretWord" type="text" value="currentGuessed" />
  201. <br />
  202. <input id="letters" type="button" name="a" value="a" onClick="turn('a');"><!-- as player guess wrong letter change to red and make unusable so player can not choose the letter again-->
  203. <input id="Button1" type="button" name="b" value="b" onClick="turn('b');">
  204. <input id="Button2" type="button" name="c" value="c" onClick="turn('c');">
  205. <input id="Button3" type="button" name="d" value="d" onClick="turn('d');">
  206. <input id="Button4" type="button" name="e" value="e" onClick="turn('e');">
  207. <input id="Button5" type="button" name="f" value="f" onClick="turn('f');">
  208. <input id="Button6" type="button" name="g" value="g" onClick="turn('g');">
  209. <input id="Button7" type="button" name="h" value="h" onClick="turn('h');">
  210. <input id="Button8" type="button" name="i" value="i" onClick="turn('i');">
  211. <input id="Button9" type="button" name="j" value="j" onClick="turn('j');">
  212. <input id="Button10" type="button" name="k" value="k" onClick="turn('k');">
  213. <input id="Button11" type="button" name="l" value="l" onClick="turn('l');">
  214. <input id="Button12" type="button" name="m" value="m" onClick="turn('m');">
  215. <input id="Button13" type="button" name="n" value="n" onClick="turn('n');">
  216. <input id="Button14" type="button" name="o" value="o" onClick="turn('o');">
  217. <input id="Button15" type="button" name="p" value="p" onClick="turn('p');">
  218. <input id="Button16" type="button" name="q" value="q" onClick="turn('q');">
  219. <input id="Button17" type="button" name="r" value="r" onClick="turn('r');">
  220. <input id="Button18" type="button" name="s" value="s" onClick="turn('s');">
  221. <input id="Button19" type="button" name="t" value="t" onClick="turn('t');">
  222. <input id="Button20" type="button" name="u" value="u" onClick="turn('u');">
  223. <input id="Button21" type="button" name="v" value="v" onClick="turn('v');">
  224. <input id="Button22" type="button" name="w" value="w" onClick="turn('w');">
  225. <input id="Button23" type="button" name="x" value="x" onClick="turn('x');">
  226. <input id="Button24" type="button" name="y" value="y" onClick="turn('y');">
  227. <input id="Button25" type="button" name="z" value="z" onClick="turn('Z');"><br />
  228. Number of Tries (6): <input id="lives" type="text" value="0" onfocus="lives.blur();" SIZE=2> 
  229. <input type="button" name="submit" value=" Start Over " onClick="gameProcess()">
  230. <input type="button" name="end" value=" END " onClick="gameEnd()"><br />
  231.  
  232.  
  233. </form>
  234.  
  235. <p>&nbsp;</p>
  236. <H2>Directions</H2>
  237. Please guess a letter to see if you figure out the secret word.<br />
  238. You will have 6 chances to guess the word, or guess a letter.<br />
  239. If you guess incorrectly you will lose a chance and your clown will be one step closer to being hung!<br />
  240. Good Luck! 
  241.  
  242. </body>
  243. </html>
  244.  
  245.  
  246.  
Mar 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
15809
by: tigrfire | last post by:
So I'm trying to write a hangman game and the output is coming out a little strange. Here's my code thus far: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> int hangman()
18
9216
ilikepython
by: ilikepython | last post by:
Hi I'm new to Python(3 to 4 days) and I'm working on a hangman game and have been having some problems that really annoy me. Here is part of my script: c = input('Would you like to play hangman? Type y or n ') word = sample(('soccer', 'robbery', 'antibiotics'), 1) word = str(word) spaces = len(word) - 4 def hangman(): print '-------- '
4
2603
by: princessfrost | last post by:
Hi! I was wondering if someone could please help me with a hangman program that I have to do. I have some ideas, but really don't know what to do or where to start. My program needs to be: interactive with the user, menu based(like Menu: 1. Play hangman 2. Exit program), have a dictionaryand use a random method(create arrays of Strings or ListArray of Strings. e.g. : String dictionary = “apple”, “ball”, “cat”, “dog”, …..} minimum words...
3
2954
by: kaka_hunter | last post by:
#include <iostream> #include <fstream> using namespace std; const int max_tries=7; int earnings=0; int wordnum; void getword () { ifstream fin;
0
1696
by: Madmartigan | last post by:
Hi I'm a newbie to C# and have been instructed to create a Hangman game in SharpDevelop. I don't want the answer to the full code, just some help along the way. I have included my code thus far and at this stage would like to know how I can get the RandomWordManager, which I found on another site, to display a newly generated word as the textBox1 text when the user enters a new game. I have enclosed tags around the two forms I have...
5
4195
by: av3rage | last post by:
I have never done any programming in my life but I have decided to go into engineering and in doing so we have to take this intro to programming course and I am pretty clueless. I am starting to get the hang of how python works but to put my thoughts into the program to make it run is the confusing part for me. The task is to implement a Hangman game and the Program Specifications are: 1) Output a brief description of the game of hangman...
8
3747
by: tidiz | last post by:
Hi, I'm trying to make a hangman game that should look like this: Welcome to Hangman ______ Your guess: c Success! __cc__ Your guess: b
1
2584
by: AlexSc | last post by:
Hi to All, I am doing on a hangman project, Where this is a very simple one, where player would guess the word and if it is correct the letter would be from "-" to the correct letter once all letter is correct they system will appear out good job u clear the game. I had done up the game and it work however i find mine is rather impractical, looking for better solution for it. please enlighten me in it. public static void...
0
9932
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11112
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10730
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7959
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7114
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4602
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4205
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3228
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.