BCA

WEB PROGRAMMING LAB

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10 PROGRAM 11 PROGRAM 12 PROGRAM 13 PROGRAM 14 PROGRAM 15 . . .

6.Create a webpage to demonstrate the use of span and div tags in DHTML.

OUTPUT:

My mother has blue eyes.

This is a heading

This is a paragraph.

 
 

<html>
<body> 
<p>My mother has <span style="color:blue">blue</span> eyes.</p> 

<div style="background-color:lightblue" id="divclick">
  <h2>This is a heading</h2>
  <p>This is a paragraph.</p>
</div>

<button  name="change"  onclick="myFunction()">change </button>

<script>
 
var div = document.getElementById( 'divclick' );

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


 function myFunction(){
var div = document.getElementById( 'divclick' );
  div.style.backgroundColor = '#666666';
}

</script>


</body> </html>