Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , ,

Sponsored Links



JavaScript Switch Statement

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 03-11-2009
Member
 
Join Date: Apr 2009
Posts: 79
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.
Reply With Quote
  #2  
Old 03-11-2009
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,267
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>
Reply With Quote
  #3  
Old 03-11-2009
Member
 
Join Date: Jan 2009
Posts: 199
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.
}
Reply With Quote
  #4  
Old 03-11-2009
Member
 
Join Date: Dec 2008
Posts: 177
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>
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 11:58 AM.