Ex No:5 Date:: Design A Webpage To Create Simple Interactive Cgpa Calculator Using Event Handling
Ex No:5 Date:: Design A Webpage To Create Simple Interactive Cgpa Calculator Using Event Handling
CODING:
INDEX PAGE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <link
rel="stylesheet" href="styles.css"> <title>Percentage Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}
.container {
max-width: 400px;
margin: 0 auto;
padding: 30px;
background-color: #fff;
border-radius: 20px;
}
.container:hover{
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
h1 {
text-align: center;
color: #333;
}
label {
font-weight: bold;
}
input
{ width:
100%;
padding: 8px;
margin-bottom: 10px;
}
button {
background-color: #007BFF;
color: #fff;
border: none;
padding: 10px 20px;
cursor: pointer;
border-radius: 10px;
}
</style>
</head>
<body>
<script>
function calculatePercentage() {
const chemistryMarks = parseFloat(document.getElementById('chemistry').value);
const hindiMarks = parseFloat(document.getElementById('hindi').value);
<div id="result">
<p>Total: <span id="totalMarks">---</span></p>
<p>Percentage: <span id="percentage">---</span>%</p>
<p>Grade: <span id="grade">---</span></p> </div>
</div>
</body>
</html>
OUTPUT:
RESULT:
Thus the static web pages required for an online book store website is designed
successfully.