Midd_Knight
09-21-2004, 10:14 PM
I'm using an old javascript form valadation script, to let users input a number. This number pertains to an online rpg game, that has treasure trail clues. Some are Choords, used with a sexant to find.
Anyway, the problem happens with choords begining with "0". I have a total of 26 actual options. The first 4 options that begin with zero work fine. However, any choord string beging with zero after the first 4, do not. (Any of them, the script just moves down to the final alert.) Numbers that begin with anything from 1-9, works fine.
Here's an example of my script;
function valid(form) {
var field = form.choord;
var choord = field.value;
if (!choord) {
alert("You must indicate a choord.");
return false;
} else if (choord == 01260801) {
alert("");
return true;
} else if (choord == 02482230) {
alert("");
return false;
} else if (choord == 21241754) {
alert("");
return true;
} else {
alert("Sorry, I could not find that location.");
field.focus();
field.select();
return false;
}
}
Why would this be happening? Could anyone point me in the right direction here? Also, here is a version of the full script.
http://liquidclock.net/load.lcf?id=treasuretrails
Any help, would be a blessing. Thanks for any input guys!
Anyway, the problem happens with choords begining with "0". I have a total of 26 actual options. The first 4 options that begin with zero work fine. However, any choord string beging with zero after the first 4, do not. (Any of them, the script just moves down to the final alert.) Numbers that begin with anything from 1-9, works fine.
Here's an example of my script;
function valid(form) {
var field = form.choord;
var choord = field.value;
if (!choord) {
alert("You must indicate a choord.");
return false;
} else if (choord == 01260801) {
alert("");
return true;
} else if (choord == 02482230) {
alert("");
return false;
} else if (choord == 21241754) {
alert("");
return true;
} else {
alert("Sorry, I could not find that location.");
field.focus();
field.select();
return false;
}
}
Why would this be happening? Could anyone point me in the right direction here? Also, here is a version of the full script.
http://liquidclock.net/load.lcf?id=treasuretrails
Any help, would be a blessing. Thanks for any input guys!