...

View Full Version : Why script does not work...



oh5yw
12-07-2006, 10:30 AM
this works:

if (parts[3] == "#742") {
tiny.image = hot;
} else {
tiny.image = cold;
}

but this dont, why:

if (parts[3].CharAt(0) == "#") {
tiny.image = hot;
} else {
tiny.image = cold;
}

I need to get firts character of parts[3] and if it is # then go on...
parts[3] can be "#xxx", "$xxx", "ABCD" or "1234"


Am I stupid or what?

Arty Effem
12-07-2006, 11:46 AM
this works:

if (parts[3] == "#742") {
tiny.image = hot;
} else {
tiny.image = cold;
}

but this dont, why:

if (parts[3].CharAt(0) == "#") {
tiny.image = hot;
} else {
tiny.image = cold;
}

I need to get firts character of parts[3] and if it is # then go on...
parts[3] can be "#xxx", "$xxx", "ABCD" or "1234"

Am I stupid or what?If you're going to play with JavaScript -> RTFConsole, that's why it's there.

oh5yw
12-07-2006, 11:52 AM
what is rtfconsole?

Roy Gardiner
12-07-2006, 11:53 AM
May I also suggest that you post a complete working page, with just your error in it? What you've posted requires some work before it can be run.

One problem is that CharAt should be charAt.

Philip M
12-07-2006, 05:26 PM
If you're going to play with JavaScript -> RTFConsole, that's why it's there.

This response was wholly uncalled for. If you don't want to help a newcomer, then I suggest that you keep quiet.


1 Posting rules

1.1) Always be respectful and polite when posting- There is absolutely no excuse to be rude, confrontational, or hostile when posting on CodingForums.com. This is a place where web programmers come together to solve problems, not create them. Flaming can get you banned.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum