Question: change color of back ground using switch

Ads

 
 
 

Share on Google+Share on Google+

moulika
change color of back ground using switch
1 Answer(s)      5 years and 8 months ago
Posted in : JavaScript Questions

how to change back ground color according to day using switch case

Ads
View Answers

September 13, 2011 at 11:41 AM


<html>
<script language="javascript">
    function change(id)
    {

        switch (id)
        {
            case 'c1':
                document.body.bgColor = "red";
                break;

            case 'c2':
                document.body.bgColor = "green";
                break;

            case 'c3':
                document.body.bgColor = "yellow";
                break;    

            case 'c4':
                document.body.bgColor = "blue";
                break;

             case 'c5':
                document.body.bgColor = "pink";
                break;
        }
    }
</script>
<body>
<input type="button" id="c1" onclick="change(this.id)" value="Red"/>
<input type="button" id="c2" onclick="change(this.id)" value="Green"/>
<input type="button" id="c3" onclick="change(this.id)" value="Yellow"/>
<input type="button" id="c4" onclick="change(this.id)" value="Blue"/>
<input type="button" id="c5" onclick="change(this.id)" value="Pink"/>

</body>
</html>

Ads









Related Tutorials/Questions & Answers:
change color of back ground using switch
change color of back ground using switch   how to change back ground color according to day using switch case
back ground mechanism of jsf framework
back ground mechanism of jsf framework  what is back ground mechanism of jsf framework?   Hi Friend, Please visit the following link: JSF Tutorials Thanks   Thanks
Advertisements
color change
color change  how to change the color in circle using scrollbar
iPhone Switch Changes Toolbar Color
iPhone Switch Changes Toolbar Color In this tutorial we will use Switch button to change the Color of Toolbar. The Switch is added through the Interface... for the Switch so that when click on Switch the color of the Toolbar changes
change player dress color
change player dress color  Hai friends, Can we change player dress color using J2ME. Please provide me an code for this. I can able to attain three colors only. Send the code to mail id. [email protected]
how to change color of titlebar in java
how to change color of titlebar in java  pls help
Change Color and Font of text
Change Color and Font of text       This section illustrates you how to change color and font of text using TextAttributes class. A string is defined and the class
change color according to the database value
change color according to the database value  any one know how to get values from database ( 1 or 0 ) and according to that change the color ( red or green) of given list
To change the color of text hyperlinks midway
To change the color of text hyperlinks midway   Is there a way to change the color of text hyperlinks midway through a page? If so, what code do I use
To change the color of text hyperlinks midway
To change the color of text hyperlinks midway   Is there a way to change the color of text hyperlinks midway through a page? If so, what code do I use
To change the color of text hyperlinks midway
To change the color of text hyperlinks midway   Is there a way to change the color of text hyperlinks midway through a page? If so, what code do I use
change navbar dropdown color in bootstrap
change navbar dropdown color in bootstrap  How to change the color of navbar dropdown color in a bootstrap based menu in a website? Thanks  ... .open .dropdown-menu { background-color: #9F0000; color:#ffffff; } Above
using switch,break and for loop
using switch,break and for loop  generate a 10 digit number and display the length of longest increasing series
using switch and break
using switch and break  generate a 10 digit number and display the length of longest increasing series
MKMapView Change Red Pin Color
MKMapView Change Red Pin Color  MKMapView Change Pin Color Hi, in my iphone map view application, i displayed the image on annotation instead of custom pin. But however on click it changes to red color pin. Can any one please
using switch case
using switch case  Define a class MENU to perform the following operation depending upon the users choice using switch case 1)print square root... choice: "); int choice=input.nextInt(); switch(choice
Change the color of the selected tab
Change the color of the selected tab Swing provides different methods to give color effects which gives a presentable look to the components. In this section, you will learn how to change the color of the selected tab. For this, we have
JavaScript change background color automatically
JavaScript change background color automatically In this section, you will learn how to change the background color of the web page automatically. Now..., we have used using the Math.random(). The window.setTimeout() function change
Java Servlet Change Background Color
Java Servlet Change Background Color You can provide an effective way to the web page by changing the background color of the web page. In servlet, you can do this by using javascript. Here, we are going to change the background color
Change background color of text box - Java Beginners
Change background color of text box  Hi how can i change... while on entering a correct value its background color should change green... problem. Please try the code. Change background Color function
Change Background color using Custom Tag
Change Background color using Custom Tag In this program, We will create a Custom Tag which changes the background color. JSP Custom Tags : Provide... according to your choice, this background color change is due to the custom tag
How can I change UIButton title color?
How can I change UIButton title color?  Hi, I have a button in my iPhone/iPad application. I want to change the color of the text when user clicks..., You have to set the color of the button for a particular state say
How to change the color of a base64-encoded png image JQuery?
How to change the color of a base64-encoded png image JQuery?  I am going to change the colors of the pixels of a png image(which is in base64 format.... the original image is shown, but the color does not change. Do you know why
how to change div background color in javascript
how to change div background color in javascript  how to change div background color in javascript ?   <div id="Name">   <div class="content">      <h2>Your Name here</h2>       <p>First
using if and switch stmt - Java Beginners
using if and switch stmt  A cloth showroom has announced... be assumed. Write a program using "switch and if statement" to compute net amount...(); switch(menu) { case 1: System.out.print("Quantity: "); int q1 = scan.nextInt
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO..."); System.out.println("| q. Quit"); question = console.next().charAt(0); System.out.println(); switch (question
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO..."); System.out.println("| q. Quit"); question = console.next().charAt(0); System.out.println(); switch (question
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO..."); System.out.println("| q. Quit"); question = console.next().charAt(0); System.out.println(); switch (question
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO..."); System.out.println("| q. Quit"); question = console.next().charAt(0); System.out.println(); switch (question
UIWebView Background Color
UIWebView Background Color If you wanted to change the background color... using UIColor. UIColor object represents color and opacity (alpha value). Where as setBackgroundColor will allow you to change the color of background area
Changing background color using JavaScript
Changing background color using JavaScript  Hi Sir Is there any way to change the background color using JavaScript ? Please mention code with your... below function to change the background color & call it wherever it needed
Tutorials   
Java Spring Hibernate Struts Training code for programming How can I dynamically load user-entered data as content of jquery dialog? java webcam integration question java coding Fix Scrollbar position in a checkboxList after postback Information Save Alert Country wise redirection to files Interface in javascript connect database with javascript Zip Code ZipCode how to validate the email login How to play FLV video files on Ipad using HTML code or javascript code? Nitobi Grid is not working in IE10/IE11 jquery issue plese help RegEx Tree structure from json whose parents can be dragged and dropped from child newyorklife insurance getElementById not working javascript code for search in html file Implement The Skeleton Code Implement This Skeleton Code Mobile Automation using Appium Computer forensic application Java: Searching a string from doc files java linked list urgent !!! java linked list urgent!!! library management library management library management library management question Html form using JavaScript to display the table content java how to prevent no from unroundin off on clicking text box again in JSP and Jquery graph generation from xml design file display data from database in textbox when id entered in textbox Javascript Code for all fields how to get HTTP GET request value using javascript array Javascript Querry autocomplete(): Spring mvc with jquery: I am not getting correct value in the text filed. Please help me Create SpreadSheet same as excel using java applet Create SpreadSheet same as excel using java applet How to change focus among multiple select boxes? Write JQUERY Code Write JQUERY Code Converting jsp variable to java variable java

Ads

 
Advertisement null

Ads