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 answer.

View Answers

December 15, 2010 at 11:07 AM

Hello Friend

Pass the element & color in the given below function to change the background color & call it wherever it needed :

function setColor(element, color)
{
    element.style.backgroundColor = color;
}









Related Tutorials/Questions & Answers:
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
changing uiview background color
changing uiview background color  changing UIView background color in ios   self.view.backgroundColor = [UIColor colorWithRed:244.0f/255.0f green:230.0f/255.0f blue:183.0f/255.0f alpha:1.0f
Advertisements
changing Background Color
changing Background Color   ... change background color of a pdf file. You can change the background color... color) to set the background color of that chunk. Here we pass
Javascript background color - Java Beginners
Javascript background color  Hi How to compare background color...; Hi Friend, If you want to change the background color of the textbox, try the following code: Change background Color function check
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 have facing the problem that color is not changing. Can somebody suggest me
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
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... the background color after every 5 seconds. Here is the code
UIWebView Background Color
UIWebView Background Color If you wanted to change the background color on UIWebView in iPhone SDK, then you required to set the background color of UIWebView using UIColor. UIColor object represents color and opacity (alpha value
changing selection color of <button>
changing selection color of   dear all, i have loaded image in border less button tag when button is selected with tab key i get brown color... valign=middle > <figure> <button style="background-color:black
UITextfield Background Color
UITextfield Background Color  In my iPhone application, i am using... is ..it's showing a background color. Though my text field color is white. Can you please suggest.. , how can i remove the background color of text field. Thanks!  
div background color in html
div background color in html   How to change the background color of DIV in HTML
uiscrollview background color
uiscrollview background color  Is it possible to set the uiscrollview background color in iPhone application
HTML document's background color
HTML document's background color  How to set a HTML document's background color
color changing - Java Beginners
color changing  sir how to change the color of the selected tab in java swing  Hi Friend, Try the following code: import javax.swing.*; import java.awt.*; import javax.swing.event.*; import java.awt.event.
jframe background color not showing
jframe background color not showing  jframe background color is not showing. please suggest.   Just add the background color to JPanel and then add it to JFrame. For example .. JFrame myFrame = new JFrame(); JPanel
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
Setting bootstrap container background color
the color using the following code: body { background-color: #fff; } You can... the background color of the container in bootstrap for a web page? Thanks   Hi.... Above code sets the background color to white. (adsbygoogle
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... : In this Example, We will create a Custom Tag which changes the background color
Changing the message box to a specific color
Changing the message box to a specific color  How do you change the message box color to a specific color? I can get the color to change with each input but i cant give it a specific color. Example I'm trying to change
HTML - table background color.
HTML - table background color. Description : Here, you will see how to specifies the table back ground color in html page. The <table > is a html... the background color of table.  Code : <!DOCTYPE html PUBLIC "
How to design a changing color of the chameleon, changing color of the chameleon, color of the chameleon
How to design a changing color of the chameleon       Have you seen the chameleon to changing the color, you can see now by this example. Let's see how the chameleon
changing an image based on checking checkbox using HTML & JavaScript, Please put div blocks
changing an image based on checking checkbox using HTML & JavaScript, Please...;script type="text/javascript"> function showImage...; <h3 style="text-align: left; color: #286da1; padding-top: 0px;">
UITableView Background Color
changing the color of all the cells or table view background. But you can also draw...UITableView Background Color To change the background color of UITableView...]; The above line will change the default background color into gray color. You can
Change background color of text box - Java Beginners
Change background color of text box  Hi how can i change the background color to red of Javascript text box when ever user enters an incorrect value while on entering a correct value its background color should change green
pdf background color
pdf background color      ... Paragraph("Background color--->>roseinia.net"... the background of the pdf file as well as the size of a pdf file irrespective of the fact
How to set the Gradient Color as a background color for Java Frame?
How to set the Gradient Color as a background color for Java Frame?  How to set the Gradient Color as a background color for Java Frame
How to remove the background color of bootstrap menu bar?
How to remove the background color of bootstrap menu bar?  Hi, What css can be used to remove the color of bootstrap menu bar? thanks...); background-repeat: repeat-x; } This code is using the background image
Changing 2D graph using slider.
Changing 2D graph using slider.  Code for changing a 2d graph with help of slider
how to color the Eclipse editor background programmatically?
how to color the Eclipse editor background programmatically?  I have to color specific portion(background) of the of the Eclipse editor by running... as start line number and end line number and do the color in background portion
Background color blocks all labels and textfields
Background color blocks all labels and textfields  I added background color but I dont see textfields and labels anymore, please help. What am I missing? (" JFrame f = new JFrame(); SchoolOption f1 = new SchoolOption(); Color c
how to change background color in dojo tab container - Framework
how to change background color in dojo tab container  how to change background color in dojo tab container
Add color to background but I can't labels or textfields
Add color to background but I can't labels or textfields  Please help... = new JFrame(); SchoolOption f1 = new SchoolOption(); Color c = new Color(128,0,0); Container con = f.getContentPane
how to create menubar and the below background color/image in java swing
how to create menubar and the below background color/image in java swing  how to create menubar and the below background color/image in java swing
iphone Button Action (changing background of window)
iphone Button Action (changing background color of window)   In this tutorial we will change the background color on clicking the button...;setOrangeColor" as the setter function. The IBAction methods set the background color
ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color'
ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color...: ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color' How...-background-color' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color'
ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color...: ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color' How...-background-color' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo11-addon-web-editor-background-color'
ModuleNotFoundError: No module named 'odoo11-addon-web-editor-background-color...: ModuleNotFoundError: No module named 'odoo11-addon-web-editor-background-color' How...-background-color' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo12-addon-web-editor-background-color'
ModuleNotFoundError: No module named 'odoo12-addon-web-editor-background-color...: ModuleNotFoundError: No module named 'odoo12-addon-web-editor-background-color' How...-background-color' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo9-addon-web-editor-background-color'
ModuleNotFoundError: No module named 'odoo9-addon-web-editor-background-color...: ModuleNotFoundError: No module named 'odoo9-addon-web-editor-background-color' How...-background-color' error? Thanks   Hi, In your python
changing Chunk Color
changing Chunk Color     ... is a method of FontFactory. We are changing the color of the chunk... change the color of chunk color .This example tell you how you can change
Set Background Colors and Images in HTML
to the web pages by using the body attribute bgcolor and putting any color... illustrates to set a background color in HTML. In this Tutorial, the code describe you an example that helps you to set background color in HTML. The code
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
Filling Color in Excel Using JSP
filling color in excel using jsp   ... a sheet  and then  fill background color ,pattern and forground color... is used to fill the background color. You can be used the following fields
Javascript change textbox background
Javascript change textbox background In this section, you will learn how to change the background of textbox. Here we have created a textbox and allowed...' then the background changed to green otherwise it will remains red. Here is the code
How to set background of an excel sheet using POI - Java Magazine
How to set background of an excel sheet using POI  Hi, i am trying to format the excel using java. How to set the background color of an excel..., koushil Nath.  Hi friend, To set the background color of excel
delete an entry using JavaScript
delete an entry using JavaScript  How to delete an entry using JavaScript
Date object using JavaScript
Date object using JavaScript  What's the Date object using JavaScript
using for loop in javascript
using for loop in javascript  How to use for loop in JavaScript
timer using javascript
timer using javascript  How to display timer on HTML page using JavaScript
maximize an image using javaScript
maximize an image using javaScript  Write the code to maximize an image using javaScript

Ads