cs241121 Assignment07
cs241121 Assignment07
AICT LAB
ASSIGNMENT 07
QUESTION 1:-
CODE:-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 20px;
input[type="number"] {
padding: 10px;
width: 200px;
margin-right: 10px;
button {
margin-right: 10px;
cursor: pointer;
#result {
margin-top: 20px;
font-size: 20px;
Nabeel Waqas Section 1-A cs241121
font-weight: bold;
</style>
</head>
<body>
<form id="calculatorForm">
</form>
<div id="result"></div>
<script>
document.getElementById('squareButton').addEventListener('click', function() {
if (!isNaN(number)) {
} else {
});
document.getElementById('cubeButton').addEventListener('click', function() {
if (!isNaN(number)) {
} else {
});
</script>
</body>
</html>
OUTPUT:-
Nabeel Waqas Section 1-A cs241121
QUESTION 2:-
CODE:-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 20px;
#colorParagraph {
Nabeel Waqas Section 1-A cs241121
padding: 20px;
margin-bottom: 20px;
button {
margin-right: 10px;
cursor: pointer;
</style>
</head>
<body>
<p id="colorParagraph">This is a sample paragraph. Click a button below to change my background color!</p>
<button id="salmonButton">Salmon</button>
<button id="springgreenButton">Springgreen</button>
<button id="rosybrownButton">Rosybrown</button>
<button id="tealButton">Teal</button>
<script>
document.getElementById('salmonButton').addEventListener('click', function() {
document.getElementById('colorParagraph').style.backgroundColor = 'salmon';
});
document.getElementById('springgreenButton').addEventListener('click', function() {
document.getElementById('colorParagraph').style.backgroundColor = 'springgreen';
});
document.getElementById('rosybrownButton').addEventListener('click', function() {
Nabeel Waqas Section 1-A cs241121
document.getElementById('colorParagraph').style.backgroundColor = 'rosybrown';
});
document.getElementById('tealButton').addEventListener('click', function() {
document.getElementById('colorParagraph').style.backgroundColor = 'teal';
});
</script>
</body>
</html>
OUTPUT:-
Nabeel Waqas Section 1-A cs241121
Nabeel Waqas Section 1-A cs241121