hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Nothing much.
Reply

Forum Jump

Nothing much.

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 04-18-2005, 10:55 AM
Geeksterman Geeksterman is offline
WHT Addict
 
Join Date: Mar 2003
Location: Canada...In an Igloo.
Posts: 149

Nothing much.


This is my hang man script... Not totally done yet.

<script>
var Spelling=new Array("que bec","ont ario","mani toba","Brit ish","NewF oundLand");
var rNum=eval(Math.round(Math.random()*(4-1))+eval(1));
var word1=Spelling[rNum];
// -------------------------------FUNCTION STARTGAME - STARTS THE GAME AND OUTPUTS STARS-SPACES ETC!
function STARTGAME() {

var starword=""
var space="";
for (var i=0; i<word1.length; i=i+1) {
if (word1.charAt(i) == " ") {
space=" ";
starword=starword+space;
space="";
} else {
starword=starword+"*"
space="";
} //END IF
} //END FOR
document.HangManGame.KeyWord.value=starword;
} //END FUNCTION


// ----------------------------------------------FUNCTION TRYLETTER - TRIES TO SEE IF THE LETTER IS IN THE WORD.
function TRYLETTER() {
var Trylett=document.HangManGame.YourGuess.value;
alert(word1);

for (var i=0; i<word1.length; i=i+1) {
if (word1.charAt(i) == Trylett) {
KeyWord=
alert("FOUND")
} else {
alert("NOT FOUND")
} // END IF
} // END FOR
} // END FUNCTION


//------------------FUNCTION SOLVEIT - IF THE USER TRIES TO SOLVE IT - IT CHECKS TO SEE IF IT IS EQUALS.
function SOLVEIT() {
}

</script>

<img src="6.jpg" name="BuzzLightYear">
<form name="HangManGame">

<P>
Mystery Word: <input type="textbox" name="KeyWord"><P>
Your Guess: <input type="textbox" name="YourGuess"> <input type="button" value="Try Letter" onClick="TRYLETTER()"><P>
Status: <input type="textbox" name="Status"><P>
<input type="textbox" name="SolveWord"> <input type="button" value="Solve It Now!" onClick=" randint()"><P>
<input type="button" value="Start Game" onClick="STARTGAME()">
</form>

__________________
This is my signature. Nice, eh?



Sponsored Links
  #2  
Old 04-18-2005, 04:06 PM
CreativeLogic CreativeLogic is offline
Web Hosting Guru
 
Join Date: Aug 2002
Posts: 261
Place it in the PHP BBCode. It makes it 10x easier to read!

  #3  
Old 04-19-2005, 11:01 AM
Geeksterman Geeksterman is offline
WHT Addict
 
Join Date: Mar 2003
Location: Canada...In an Igloo.
Posts: 149
PHP Code:
<script>
var 
Spelling=new Array("quebec","ontario","manitoba","british columbia","newfoundLand");
var 
rNum=eval(Math.round(Math.random()*(4-1))+eval(1));
var 
word1=Spelling[rNum];
var 
starword="";
// -------------------------------FUNCTION STARTGAME - STARTS THE GAME AND OUTPUTS STARS-SPACES ETC!

function STARTGAME() {

var 
space="";
for (var 
i=0i<word1.lengthi=i+1) {
if (
word1.charAt(i) == " ") {
space=" ";
starword=starword+space;
space="";
} else {
starword=starword+"*"
space="";
}  
//END IF
//END FOR
document.HangManGame.KeyWord.value=starword;
}  
//END FUNCTION


// ----------------------------------------------FUNCTION TRYLETTER - TRIES TO SEE IF THE LETTER IS IN THE WORD.

function TRYLETTER() {
var 
hittmiss="MISS";
var 
Trylett=document.HangManGame.YourGuess.value;
//var Trylett=Trylet.toLowerCase();
alert(Trylett);
//alert(word1);
for (var i=0i<word1.lengthi=i+1) {
if (
word1.charAt(i) == Trylett) {
starword=starword.substring(0,i)+Trylett+starword.substring(i+1,starword.length);
document.HangManGame.KeyWord.value=starword;
hittmiss="HIT";
} else {


}  
// END IF
// END FOR

document.HangManGame.Status.value=hittmiss;
// END FUNCTION


//------------------FUNCTION SOLVEIT - IF THE USER TRIES TO SOLVE IT - IT CHECKS TO SEE IF IT IS EQUALS.
function SOLVEIT() {
if (
document.HangManGame.SolveWord.value == word1) {
alert("You won the game!");
} else {
alert("You lost");
}

}

</script>

<img src="6.jpg" name="BuzzLightYear">
<form name="HangManGame">

<P>
<table border=1>
<tr><td>Mystery Word: <input type="textbox" name="KeyWord"></td><td></td></tr>
<tr><td>Your Guess:  <input type="textbox" name="YourGuess"></td><td><input type="button" value="Try Letter" onClick="TRYLETTER()"></td></tr><P>
<tr><td>Status: <input type="textbox" name="Status"></td><td></td></tr>
<tr><td><input type="textbox" name="SolveWord"></td><td><input type="button" value="Solve It Now!" onClick="SOLVEIT()"></td></tr>
<tr><td><input type="button" value="Start Game" onClick="STARTGAME()"></td><td></td></tr>
</table>
</form> 

__________________
This is my signature. Nice, eh?

Sponsored Links
  #4  
Old 04-19-2005, 12:54 PM
Burhan Burhan is offline
Community Guide
 
Join Date: Jul 2003
Location: Kuwait
Posts: 5,099
Are you just posting it here for posterity, or you need help with something?

__________________
In order to understand recursion, one must first understand recursion.
If you feel like it, you can read my blog
Signal > Noise

Reply

Related posts from TheWhir.com
Title Type Date Posted


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?