how to change div background color in javascript

how to change div background color in javascript

how to change div background color in javascript ?

View Answers

September 14, 2011 at 12:17 PM

<div id="Name">

  <div class="content">
     <h2>Your Name here</h2>
      <p>First and last name</p>
  </div>

var div = document.getElementById( 'div_id' );
div.onmouseover = function() {
  this.style.backgroundColor = 'green';
  var h2s = this.getElementsByTagName( 'h2' );
  h2s[0].style.backgroundColor = 'blue';
};
div.onmouseout = function() {
  this.style.backgroundColor = 'transparent';
  var h2s = this.getElementsByTagName( 'h2' );
  h2s[0].style.backgroundColor = 'transparent';
};

Ads









Related Tutorials/Questions & Answers:
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... and last name</p>   </div> var div = document.getElementById( 'div
div background color in html
div background color in html   How to change the background color of DIV in HTML
Advertisements
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
How to change background, change background
How to change background       This example will teach you to change background of any object... a picture to change background. Selection: Make selection by the Magic wand tool
div style background
div style background  How to add background color to a div? What is the code of div style background?   Hi, You can use the following code: <div style="background-color: #ccffcc;"> <p>Content</p> <
how to change color of titlebar in java
how to change color of titlebar in java  pls help
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
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
to change the styleclass color of <apex:outputlabel > 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...to change the styleclass color of onclick button function in javascript 
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   Hi, Use the following code: .navbar { background-image: url(/d2/images
How to add background image to div using CSS?
How to add background image to div using CSS
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
Jbutton[] background & foregroundcolor change
Jbutton[] background & foregroundcolor change  how to change... foreground and background color is changed. the remaining jbutton foreground and background color are not changed. next i select button[9] then the button[5] foreground
How to animate div with jQuery and JavaScript?
;html> <head> <title>How to animate div with jQuery and JavaScript...; div { background-color:white; width:100px; border:1px solid grey; } <...Adding maximize effect to a div: How to animate div with jQuery
How to animate div with jQuery and JavaScript?
;html> <head> <title>How to animate div with jQuery and JavaScript...; div { background-color:white; width:100px; border:1px solid grey; } <...Adding maximize effect to a div: How to animate div with jQuery
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
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 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
UITextfield Background Color
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!   iPhone UITextField Background Color Set the text field background color
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... example......</h1><hr/> <sx:div id="displayImage"
uiscrollview background color
uiscrollview background color  Is it possible to set the uiscrollview background color in iPhone application
changing Background Color
change background color of a pdf file. You can change the background color...: setBackground(Color color):  If you want to change the background... changing Background Color   
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
JavaScript getElementById div
JavaScript getElementById div...; </head> <body> <div style="background: #DFDFFF...;/p> <div id="myDiv" style="background:#ffffdd; height
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
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
How to set pdf background color.
How to set pdf background color. In this example, you will see how to set back ground color of pdf in struts2.  index.jsp <html> <...;/title></head> <body> <p>Background of file
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
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 "
Setting bootstrap container background color
Setting bootstrap container background color  How to set the background color of the container in bootstrap for a web page? Thanks   Hi, You can set the color using the following code: body { background-color
How to change HTML button onclick to autoclick - javascript function
How to change HTML button onclick to autoclick - javascript function  Can any one give me a block of code to change the HTML button onclick to autoclick. The method must be in Java Javascript
How to change HTML button onclick to autoclick - javascript function
How to change HTML button onclick to autoclick - javascript function  Can any one give me a block of code to change the HTML button onclick to autoclick. The method must be in Java Javascript
dynamic image change javascript
dynamic image change javascript  How to display images in JavaScript dynamically
pdf background color
pdf background color       In this program we are going to tell you how we can change the background of the pdf file as well as the size of a pdf file irrespective of the fact
JavaScript move div
JavaScript move div...; This section illustrates you how to move a div element on the window using JavaScript. In the following code, we have defined a div element consisting of text
change content of cell javascript
change content of cell javascript  change content of cell javascript
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
JavaScript Hide Div
JavaScript Hide Div...; In this section, we are going to hide div element on clicking the button using the JavaScript. In the given example, we have created a div element using <div>
JavaScript Change link
; In this section, you will learn how to change the link's text in JavaScript... JavaScript Change link's text... over it. The JavaScript property innerHtml allows you to change your text
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
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?  In a jsp page InsertUpdate.jsp (say) there is a button Insert to Save data in the database.I want that on clicking Insert button, besides
How to design a background, design a background, a background
How to design a background     ... how to design a background by this example. New File: Take a new file. Choose color: First set the foreground and background color. Clouds: Go to Filter menu
Change Background of Slide Using Java
Change Background of Slide Using Java   ... then change background of the slide. In this example we are creating an object..., setBackgroundColor(Color.blue) method to set background color
MKMapView Change Red Pin Color
MKMapView Change Red Pin Color  MKMapView Change Pin Color Hi... of custom pin. But however on click it changes to red color pin. Can any one please tell me how can i show the same image ever after it's taped.   
How to make a chrome background, make a chrome background, chrome background
How to make a chrome background     ... background so follow all the steps as given in this example. New Document: First take a new document with any color background and fill "White" color
Change Color and Font of text
Change Color and Font of text       This section illustrates you how to change color... to render text and the TextAttribute.FOREGROUND sets the color. The values
ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color'
: ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color' How...ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color...-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' How...ModuleNotFoundError: No module named 'odoo10-addon-web-editor-background-color...-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' How...ModuleNotFoundError: No module named 'odoo11-addon-web-editor-background-color...-background-color' error? Thanks   Hi, In your python

Ads