Ex No: 7 BANNER ADVERRTISEMENT
Aim: To write a JavaScript code to implement banner advertisement that changes images every 10 seconds.
Algorithm
Step1: Create a folder “Ex7” to place the HTML files.
Step2: Create HTML file “index.html”.
Step3: Create a folder "images" and place the banner images.
Step4: Add JavaScript code to change banner image evert 10 seconds.
Source Code

index.html


<html>
 <head>
  <title>Banner Advertisement</title>
  <style>
  body {
	background-color:#F7F18A;
  }
  section {
	text-align:center;
	margin: 20px;
  }
  </style>
  <script type="text/javascript">
   
   //call the function every 10 seconds
   setInterval(bannerTimer,10000);
   
   var i = 1;
   var path = "images/";
   
   function bannerTimer()
   {
    file = path + i +".jpg";
	document.getElementById("banner").src = file;
	if(i>=4)
		i = 1;
	else
		i++;
   }
  </script>
 </head>
 <body>
  <header>
   <div>
    <img src="images/4.jpg" id="banner" name="banner" alt="Banner"/>	
   </div>
  </header>
  <hr/>
  <section>
	<h1>Banner Advertisement</h1>
  </section>
 </body>
</html>
Result: Thus JavaScript code is written to implement banner advertisement.