|
| |||||||||
| Tags: conditional statements, javascript, switch statement, syntax |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| JavaScript Switch Statement
What are the syntax used in JavaScript Switch Statement. I know the Conditional statements are used to perform different actions but what is the switch statement is and how to use it. |
|
#2
| ||||
| ||||
| Re: JavaScript Switch Statement JavaScript Switch Statement : Code: <script type="text/javascript">
<!--
var Color = "blue";
switch (Color)
{
case "blue":
document.write("blue color!");
break
case "blue":
document.write("Just like color");
break
default:
document.write("Suit to sky...");
}
//-->
</script> |
|
#3
| |||
| |||
| Re: JavaScript Switch Statement
Basic JavaScript switch Syntax : Code: var y = 12;
switch (y) {
case 5:
// Do something.
case 12:
// Do something else
// (this will be executed).
case 15:
// Do something else.
} |
|
#4
| |||
| |||
| Re: JavaScript Switch Statement javascript switch statement example : Code: <script type="text/javascript">
var k=new Date();
theDay=k.getDay();
switch (theDay)
{
case 5:
document.write("Friday");
break;
case 6:
document.write(" Saturday");
break;
case 0:
document.write(" Sunday");
break;
default:
document.write(" weekend!");
}
</script> |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "JavaScript Switch Statement" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to use switch statement in java | Raju Chacha | Software Development | 2 | 3 Weeks Ago 06:40 PM |
| Java program to use enum in switch statement. | MADGE25 | Software Development | 5 | 01-02-2010 06:12 PM |
| Need Codings for PHP Switch Statement? | NGV BalaKrishna | Software Development | 5 | 27-01-2010 10:31 PM |
| Switch Statement in PHP | Projectkmo | Software Development | 2 | 31-03-2009 01:31 PM |
| SWITCH....CASE statement in C# | Aadarsh | Software Development | 1 | 10-11-2008 05:39 PM |