|
-
Feb 27th, 2003, 05:06 PM
#1
Thread Starter
Member
Javascript question
Ok heres what i got, i am getting an error 'cannot assign to a function result' whenever i run this function .. I am gonna post only the first half of the code cuz it is kind of long ,
Code:
sofar="______";
thepot="";
s="";
p="";
theword="";
l=0;
function HangMan() {
theword="daniel";
l=theword.length
if (sofar=theword) {
Finish();
}
userin= prompt('Guess a lettter');
//The For Loop is where it says its happening i have never
// seen this error before so i dont know what it means
for (x = 1; x < l; i++) {
if (theword.substring(x,1)=userin) {
sofar+=theword.substring(x,1);
RefVar();
}
}
If anyone could help i would greatly appreciate it..
oOblackorbOo
-
Feb 27th, 2003, 05:32 PM
#2
Fanatic Member
I think it is your "=" signs. "=" by itself is used to set something to something else. What you want is "==".
so it would look like this on the if statements.
Code:
if (theword.substring(x,1)==userin)
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
-
Feb 27th, 2003, 05:40 PM
#3
Thread Starter
Member
Now i am getting 'Object Expected' at this line of code
Code:
userin=prompt('Guess a lettter');
I fix one thing then its on to another!
-
Feb 27th, 2003, 06:21 PM
#4
Fanatic Member
Actually I think your error is occuring at the start of the For loop.
for (x = 1; x < l; i++)
The i++ should be x++
Try this instead and let me know if you need anything else:
for (x = 1; x < l; x++)
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
-
Feb 27th, 2003, 06:29 PM
#5
Thread Starter
Member
now i am getting the first error again at
if (theword.substring(x,1)==userin) {
Well at least thats where IE Says it is
Dang IT!
-
Feb 27th, 2003, 06:30 PM
#6
Thread Starter
Member
it looks like its only happening when i type in the letter 'a'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|