PDA

View Full Version : case selects in JScript


snowbaby
08-27-2003, 09:02 AM
Hi I've not done anything really with JavaScript.

I'm working an .asp application in VBScript and to to the Form Validation for a page I need to use Java.

I've got a drop down menu on the form and need to run an enter of x number of textbox's dependent on teh number selected in the drop down menu. Due to the form being quite large I need to not have to re-load it.

I've managed to get if statements together to validate the rest of the form but with the 'if its this do this, if its this do this doesn't work'

I've thought of using Select Case() (as would be in VB but I can't work out the Java for it.

Any ideas accepted with thank's be some code or just how to do Select Case() in Java

Thanx's :D

Whitesword
08-27-2003, 03:17 PM
The command your looking for is switch... case.

Unfortunately, it's a little limited in that the case statements cannot evaluate expressions, it can only parse constant or literals.

ANyway it goes like this

switch(<expression>)
{
case <constant>:
// do something here
break;
case <constant>:
// do something here
break;
default: // same as case else
break;
}


HTH

Whitesword

snowbaby
08-28-2003, 08:32 AM
Thankx's That works great.