Assesment 1


 SET-1)
<html lang="en">
<head>
<meta charset="utf-8">
<title>Change the Background Color with JavaScript</title>
</head>
<body>
    <h1 id="heading">This is a heading</h1>
    <p>This is a paragraph of text.</p>
    <hr>
    <table>
        <tr>
        <td><label>Change Webpage Background To:</label><td>
        <td>
        <button type="button" onclick="bodybg('yellow');">Yellow</button>
        <button type="button" onclick="bodybg('lime');">Lime</button>
        <button type="button" onclick="bodybg('orange');">Orange</button>
        <button type="button" onclick="bodybg('red');">Red</button>
        <button type="button" onclick="bodybg('pink');">Pink</button>
        </td>
        <tr>
    </table>
    <br>
    <br>
    <br>
    <table>
        <tr>
        <td><label>Change Heading Background To:</label></td>
        <td>
        <button type="button" onclick="headingbg('red');">Red</button>
        <button type="button" onclick="headingbg('green');">Green</button>
        <button type="button" onclick="headingbg('blue');">Blue</button>
        <button type="button" onclick="headingbg('red');">Red</button>
        <button type="button" onclick="headingbg('pink');">Pink</button>
        </td>
        </tr>
    </table>
    <script>
        function bodybg(color){
            document.body.style.background = color;
        }
   
        function headingbg(color){
            document.getElementById("heading").style.background = color;
        }
       
    </script>
</body>
</html>

SET-2)
<html>
<head>
</head>
<body bgcolor="green">
<h1 id="demo" onmouseover="mouseOver()" onmouseout="mouseOut()">Hello, This is My New Web Page</h1>
<script>
function mouseOver() {
  document.getElementById("demo").style.color = "yellow";
}
function mouseOut() {
  document.getElementById("demo").style.color = "blue";
}
</script>

</body>
</html>

Comments

Popular posts from this blog

SET(A) Q1

Exercise 2

Exercise 4