frozentree Posted February 28, 2006 Share Posted February 28, 2006 i have notice this.......switch statement Only works with document.bgcolor and .write.....is this true?? Link to comment Share on other sites More sharing options...
aspnetguy Posted February 28, 2006 Share Posted February 28, 2006 i have notice this.......switch statement Only works with document.bgcolor and .write.....is this true??<{POST_SNAPBACK}> You can use the switch statement for anything.for example you are passing a variable to a function and want ot return a value based on the variable you passed in.function doSwitch(myVar){ switch(myVar) { case "yes": return "it said yes"; break; case "no" : return "it said no"; break; case "maybe": return "it's not sure"; break; default: return "something went wrong"; break; }} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now