Ajax Loader
×
HTML
  <div class="d1" onclick="asa(this)">1
1
  <div class="d1" onclick="asa(this)">1
2
    <div class="d2" onclick="asa(this)">2
3
      <div class="d3" onclick="asa(this)">3</div>
4
    </div>
5
  </div>
 
CSS
  .d1{
1
  .d1{
2
    background-color:green;
3
    width: 150px;
4
    height: 150px;
5
    position: relative;
6
  }
7
  .d2{
8
    background-color:blue;
9
    width: 100px;
10
    height: 100px;
11
    position: absolute;
12
  }
13
  .d3{
14
    background-color:red;
15
    width: 50px;
16
    height: 50px;
17
  }
 
JavaScript
function asa(elem){
1
function asa(elem){
2
    elem.style.backgroundColor = 'yellow';
3
    alert(elem.className)
4
    elem.style.backgroundColor = '';
5
  }
 

Untitled

CSSDeck G+