change color of back ground using switch

Ads
 

change color of back ground using switch

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

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
how to change color of titlebar in java
how to change color of titlebar in java  pls help
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
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
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
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
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 Changing Toolbar Color using iPhone Application ?
How to Changing Toolbar Color using iPhone Application ?  Hi, i have developing a small application to changing the toolbar color in iphone. But i... the online reference or example of how to change toolbar color in iPhone Apps
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
How to change table row color when click on Hyper Link in jsp?
How to change table row color when click on Hyper Link in jsp?  I use... row2 row3.. when click on the link1 automatically change the the row1 color,similarly when click on the link2 automatically change the the row2
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
to change the styleclass color of <apex:outputlabel > onclick button function in javascript
to change the styleclass color of onclick button function in javascript ... , then through javascript how can we change the color of outputlabel to red color .my { color: Black; font-size: 10px; font-family: Arial
How to change color of opened Bootstrap drop down toggle?
How to change color of opened Bootstrap drop down toggle?  HI... to change the color of the same? Thanks   Hi, Following code works well... .navbar-nav .open .dropdown-menu { background-color: #9F0000; color
Change JPanel background color from mouse entered/exit event
Change JPanel background color from mouse entered/exit event  I have..."); and I got it to work that way but I couldn't get the tile JPanels to change color with setBackground(new Color());. Any suggestions would be greatly appreciated
Write a java program to display the season given the month using switch case
Write a java program to display the season given the month using switch case  Write a java program to display the season given the month using switch case
core java ,io operation,calling methods using switch cases
core java ,io operation,calling methods using switch cases  How to create a dictionary program,providing user inputs using io operations with switch cases and providing different options for searching,editing,storing meanings
Browser Back Button Disable/Hide/Invisible using Java Script
Browser Back Button Disable/Hide/Invisible using Java Script  Dear Sir, Please Help..., Q: How to Write Code For Browser Back Button Disable/Hide/Invisible using Java Script without Page Reload/Refreshing. anyone
How to change image size before adding to mysql using jsp
How to change image size before adding to mysql using jsp  I want to upload an image to MySQL DB, before inserting the image I want to change the image size as per defined by me and then I want to store that image into my DB
Change root password of MYSQL using Java
Change root password of MYSQL using Java In this tutorial, you will learn how to change the root password of MYSQL database using java code. For every..., the system administrator user is called root. You can also set the new password using
Switch databases
Switch databases  How do you inter-change between relational databases without code changes
How to change value of div using Ajax in struts.
How to change value of div using Ajax in struts. In this example, we will introduce you to how to change value of div tag using Ajax in struts, without...="%{imagePage}" targets="displayImage"> Change Content
Looking for change password in iphone application sdk using sqlite
Looking for change password in iphone application sdk using sqlite  i am trying to change old password in my iphone application my code is below please help how can i do .... -(IBAction)matchpassword{ //sqlite3_stmt
How to prevent from navigating to ck buttonnext page when user reaches login page using back button
page using back button  Hi sir, I have created 2 pages, 1) Lo gin Page... goback to user login page using back button and agin click browser forward button.... I am using html,php,javascript.. Please provide me a better code to attain

Ads