Help me add html code to the attached link

liunx

Guest
<!-- m --><a class="postlink" href="http://javascript.internet.com/games/hangman.html">http://javascript.internet.com/games/hangman.html</a><!-- m --><br />
I like the script of this Hangman but would like to do it, not for Presidents, but for words. If they do or do not guess the word I would like to give them the meaning of the word (so the kids vocabulary can increase!) <br />
Can somebody help me by adding an html colde to it so that the meaning is displayed when the word is fully written (whether the word is guessed or it comes up as 'You lose' and the computer gives the word and the meaning.<br />
Thanks:(<!--content--><BODY><br />
<br />
<center><br />
<table border=8 bgcolor=white width=60% cellspacing=0><br />
<tr><td><br />
<center><br />
<h2>Hangman!</h2><br><br />
<b><h3><font color=red>Topic:</font> <br />
Presidents of The United States</h3></b><br />
<hr><br><br />
<br />
<SCRIPT LANGUAGE="JavaScript"><br />
<br />
<!-- Original: Rick Glusick --><br />
<br />
<!-- This script and many more are available free online at --><br />
<!-- The JavaScript Source!! <!-- m --><a class="postlink" href="http://javascript.internet.com">http://javascript.internet.com</a><!-- m --> --><br />
<br />
<!-- Begin<br />
function getCookie (name) {<br />
var dcookie = document.cookie;<br />
var cname = name + "=";<br />
var clen = dcookie.length;<br />
var cbegin = 0;<br />
while (cbegin < clen) {<br />
var vbegin = cbegin + cname.length;<br />
if (dcookie.substring(cbegin, vbegin) == cname) {<br />
var vend = dcookie.indexOf (";", vbegin);<br />
if (vend == -1) vend = clen;<br />
return unescape(dcookie.substring(vbegin, vend));<br />
}<br />
cbegin = dcookie.indexOf(" ", cbegin) + 1;<br />
if (cbegin == 0) break;<br />
}<br />
return null;<br />
}<br />
function setCookie (name, value, expires) {<br />
if (!expires) expires = new Date();<br />
document.cookie = name + "=" + escape (value) + "; expires=" + expires.toGMTString() + "; path=/";<br />
}<br />
function delCookie (name) {<br />
var expireNow = new Date();<br />
document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";<br />
}<br />
var Alphabet = new initAlphaArray()<br />
var NumOfWords = 42;<br />
var SaveData = "";<br />
var ImageNum = "";<br />
var LettersSelected = "";<br />
var RandomWord = "";<br />
var DisplayWord = "";<br />
var position = 0;<br />
var word = new WordList();<br />
var expdate = new Date();<br />
var RandomNumber = (expdate.getSeconds())%NumOfWords;<br />
function initAlphaArray() {<br />
this.length = 26<br />
this[0] = "A"<br />
this[1] = "B"<br />
this[2] = "C"<br />
this[3] = "D"<br />
this[4] = "E"<br />
this[5] = "F"<br />
this[6] = "G"<br />
this[7] = "H"<br />
this[8] = "I"<br />
this[9] = "J"<br />
this[10] = "K"<br />
this[11] = "L"<br />
this[12] = "M"<br />
this[13] = "N"<br />
this[14] = "O"<br />
this[15] = "P"<br />
this[16] = "Q"<br />
this[17] = "R"<br />
this[18] = "S"<br />
this[19] = "T"<br />
this[20] = "U"<br />
this[21] = "V"<br />
this[22] = "W"<br />
this[23] = "X"<br />
this[24] = "Y"<br />
this[25] = "Z"<br />
}<br />
function WordList() {<br />
this.length = NumOfWords;<br />
this[0] = "GEORGE WASHINGTON";<br />
this[1] = "JOHN ADAMS";<br />
this[2] = "THOMAS JEFFERSON";<br />
this[3] = "JAMES MADISON";<br />
this[4] = "JAMES MONROE";<br />
this[5] = "JOHN QUINCY ADAMS";<br />
this[6] = "ANDREW JACKSON";<br />
this[7] = "MARTIN VAN BUREN";<br />
this[8] = "WILLIAM HENRY HARRISON";<br />
this[9] = "JOHN TYLER";<br />
this[10] = "JAMES POLK";<br />
this[11] = "ZACHARY TAYLOR";<br />
this[12] = "MILLARD FILLMORE";<br />
this[13] = "FRANKLIN PIERCE";<br />
this[14] = "JAMES BUCHANAN";<br />
this[15] = "ABRAHAM LINCOLN";<br />
this[16] = "ANDREW JOHNSON";<br />
this[17] = "ULYSSES GRANT";<br />
this[18] = "RUTHERFORD HAYES";<br />
this[19] = "JAMES GARFIELD";<br />
this[20] = "CHESTER ARTHUR";<br />
this[21] = "GROVER CLEVELAND";<br />
this[22] = "BENJAMIN HARRISON";<br />
this[23] = "GROVER CLEVELAND";<br />
this[24] = "WILLIAM MCKINLEY";<br />
this[25] = "THEODORE ROOSEVELT";<br />
this[26] = "WILLIAM HOWARD TAFT";<br />
this[27] = "WOODROW WILSON";<br />
this[28] = "WARREN HARDING";<br />
this[29] = "CALVIN COOLIDGE";<br />
this[30] = "HERBERT HOOVER";<br />
this[31] = "FRANKLIN ROOSEVELT";<br />
this[32] = "HARRY TRUMAN";<br />
this[33] = "DWIGHT EISENHOWER";<br />
this[34] = "JOHN KENNEDY";<br />
this[35] = "LYNDON JOHNSON";<br />
this[36] = "RICHARD NIXON";<br />
this[37] = "GERALD FORD";<br />
this[38] = "JIMMY CARTER";<br />
this[39] = "RONALD REAGAN";<br />
this[40] = "GEORGE BUSH";<br />
this[41] = "BILL CLINTON";<br />
}<br />
function availableLetters(i) {<br />
if (LettersSelected.charAt(i)==Alphabet)<br />
document.write('<TD ALIGN=CENTER VALIGN=CENTER WIDTH=20 HEIGHT=12>' +<br />
'<B><A HREF=http://www.webdeveloper.com/forum/archive/index.php/"javascript:LoadNextPage('+i+',\''+Alphabet+<br />
'\')">'+Alphabet+'</A></B></TD>');<br />
else<br />
document.write('<TD ALIGN=CENTER VALIGN=CENTER WIDTH=20 HEIGHT=12> </TD>');<br />
}<br />
function LoadNextPage(selected,letter) {<br />
var j=0;<br />
var HoldLettersSelected = LettersSelected;<br />
LettersSelected = "";<br />
if (selected == 0) {<br />
for (j=1; j<=25; j++) {<br />
LettersSelected += HoldLettersSelected.charAt(j);<br />
}<br />
LettersSelected = "^" + LettersSelected;<br />
}<br />
else if (selected == 25) {<br />
for (j=0; j<=24; j++) {<br />
LettersSelected += HoldLettersSelected.charAt(j);<br />
}<br />
LettersSelected += "^";<br />
}<br />
else {<br />
for (j=0; j<selected; j++)<br />
{<br />
LettersSelected += HoldLettersSelected.charAt(j);<br />
}<br />
LettersSelected += "^";<br />
for (j=selected+1; j<=25; j++) {<br />
LettersSelected += HoldLettersSelected.charAt(j);<br />
}<br />
}<br />
<br />
<br />
SaveData = ImageNum + LettersSelected + RandomWord + "*";<br />
setCookie("_HangMan", SaveData, expdate);<br />
history.go(0);<br />
}<br />
<br />
// Sets a cookie that will expire in 10 days<br />
<br />
expdate.setTime (expdate.getTime() + (1000*60*60*24*10));<br />
if(getCookie("_HangMan") == null)<br />
{<br />
ImageNum = "A";<br />
LettersSelected = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";<br />
RandomWord = word[RandomNumber];<br />
SaveData = ImageNum + LettersSelected + RandomWord + "*";<br />
setCookie("_HangMan", SaveData, expdate);<br />
}<br />
else {<br />
SaveData = getCookie("_HangMan");<br />
ImageNum = SaveData.charAt(0);<br />
for (position=1; position<=26; position++) {<br />
LettersSelected += SaveData.charAt(position);<br />
}<br />
for (position=27; position<SaveData.indexOf("*"); position++) {<br />
RandomWord += SaveData.charAt(position);<br />
}<br />
}<br />
DisplayWord = "";<br />
for (i=0; i<RandomWord.length; i++) {<br />
if (RandomWord.charAt(i) == ' ') {<br />
DisplayWord += " "; <br />
}<br />
else {<br />
MatchFound = false;<br />
for (j=0; j<=25; j++) {<br />
if ((LettersSelected.charAt(j) == "^") && (RandomWord.charAt(i) == Alphabet[j])) {<br />
DisplayWord += RandomWord.charAt(i);<br />
MatchFound = true;<br />
}<br />
}<br />
if (!MatchFound) DisplayWord += "-";<br />
}<br />
}<br />
if (ImageNum == "J") {<br />
document.write('<font color=red size=4>You Lost!<br>Answer: "' + RandomWord + '"</font>');<br />
}<br />
else if (RandomWord == DisplayWord) {<br />
document.write('<font color=red size=8>You Win!</font>');<br />
}<br />
else {<br />
document.write('<table>');<br />
document.write('<tr>');<br />
for (i=0; i<13; i++) availableLetters(i);<br />
document.write('</tr>');<br />
document.write('<tr>');<br />
for (i=13; i<26; i++) availableLetters(i);<br />
document.write('</tr>');<br />
document.write('</table>');<br />
}<br />
document.write('<br>');<br />
document.write('<br>');<br />
document.write('<font size=9><tt>');<br />
document.write(DisplayWord);<br />
document.write('</tt></font>');<br />
document.write('<form>');<br />
document.write('<input type="button" VALUE="New Game"'+<br />
'onClick="delCookie(\'_HangMan\');history.go(0);">');<br />
document.write('</form>');<br />
document.write('</center>');<br />
// End --><br />
</SCRIPT><br />
</td></tr><br />
</table><br />
</center><br />
<br />
<br />
Up in this script it has a list of the Presidents from 0 to 41 (there are now 43). Just change those presidents names to words.<br />
<br />
About the meaning, that would take a while to make. I might work on that later.<!--content-->
 
Back
Top