CODE:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Addition</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<style>
.container{
background-color: buttonface;
height: auto;
border-radius: 30px;
padding: 15px;
}
</style>
</head>
<body>
<div class="container">
<h1>This is simple Addition.</h1>
<button type="button" onclick="forSum()">Click for Sum</button>
<h2 id="demo1"></h2>
<br />
<h1>The current date is:</h1>
<button type="button" onclick="document.getElementById('demo2').innerHTML=Date()">Click for Date</button>
<h2 id="demo2"></h2>
</div>
<script>
function forSum() {
var a = 5, b = 4;
var sum = a + b;
document.getElementById('demo1').innerHTML = "Sum is : " + sum;
}
</script>
</body>
</html>
OUTPUT:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Addition</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<style>
.container{
background-color: buttonface;
height: auto;
border-radius: 30px;
padding: 15px;
}
</style>
</head>
<body>
<div class="container">
<h1>This is simple Addition.</h1>
<button type="button" onclick="forSum()">Click for Sum</button>
<h2 id="demo1"></h2>
<br />
<h1>The current date is:</h1>
<button type="button" onclick="document.getElementById('demo2').innerHTML=Date()">Click for Date</button>
<h2 id="demo2"></h2>
</div>
<script>
function forSum() {
var a = 5, b = 4;
var sum = a + b;
document.getElementById('demo1').innerHTML = "Sum is : " + sum;
}
</script>
</body>
</html>
OUTPUT:
No comments:
Post a Comment