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';
};









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
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
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
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
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
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
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
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.ADS_TO_REPLACE_1 Selection: Make selection
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
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> <
UIWebView Background Color
UIWebView Background Color If you wanted to change the background color...). Where as setBackgroundColor will allow you to change the color of background area of UIWebView or UIView. This example illustrate you how to change the 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
how to change color of titlebar in java
how to change color of titlebar in java  pls help
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 
color change
color change  how to change the color in circle using scrollbar
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
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 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
How to add background image to div using CSS?
How to add background image to div using CSS
UITableView Background Color
UITableView Background Color To change the background color of UITableView...]; The above line will change the default background color into gray color. You can... changing the color of all the cells or table view background. But you can also draw
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 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?
); }); }); </script> <style> div { background-color:white; width:100px...Adding maximize effect to a div: How to animate div with jQuery... to animate div with jQuery and JavaScript?</title> <script src="https
HTML document's background color
HTML document's background color  How to set a HTML document's background color
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
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
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 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
uiscrollview background color
uiscrollview background color  Is it possible to set the uiscrollview background color in iPhone application
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...; targets="displayImage"> Change Content of Ajax div tag. </sx:a><
changing Background Color
change background color of a pdf file. You can change the background color... changing Background Color   ... color) to set the background color of that chunk. Here we pass
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
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
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
how do you change the message box to a specific color
how do you change 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 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
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
JavaScript getElementById div
JavaScript getElementById div...; In JavaScript we can get access to any node by using the method document.getElementById(). This method is very important for the JavaScript and is the entry
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>ADS...;</head> <body> <p>Background of file successfully change
Photoshop change a background image
Photoshop: change a background image   ... to change the background of an image. If you want to try this then this tutorial... in which you want to change the background image. I have selected an image
pdf background color
pdf background color       In this program we are going to tell you how we can change... Paragraph("Background color--->>roseinia.net"
How to change backgroundcolor and foreground color of JLabel in Java - Java Beginners
How to change backgroundcolor and foreground color of JLabel in Java  How to change backgroundcolor and foreground color of JLabel in Java  Hi Friend, Try the following code: import java.io.*; import java.awt.
dynamic image change javascript
dynamic image change javascript  How to display images in JavaScript dynamically
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]_TO_REPLACE_1
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 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

Ads