Dalziel
01-01-2003, 07:09 PM
I've got an if else ladder with about 15 statements in it, (two of which are shown at the bottom as an example) it would be shorter if I could convert it to a switch but I can't get it to work can it be done?
if (document.tester.you.value == "" || document.tester.you.value == "Enter your name...")
// Checking the value has been altered
{
alert("Please enter your name before using the slug tester.");
return false;
}
else if (document.tester.you.value == "Dan Leitch")
{
alert("Hi, Dan Leitch, you want a boot in the chops!");
return false;
}
if (document.tester.you.value == "" || document.tester.you.value == "Enter your name...")
// Checking the value has been altered
{
alert("Please enter your name before using the slug tester.");
return false;
}
else if (document.tester.you.value == "Dan Leitch")
{
alert("Hi, Dan Leitch, you want a boot in the chops!");
return false;
}