Future Vision BIE
ONE STOP FOR ALL STUDY MATERIALS & LAB PROGRAMS
×
Note
Login Made Mandatory to Access the Free Study Materials
-ADMIN
Page Loading! Please Wait
WEB TECHNOLOGY LABORATORY WITH MINI PROJECT
17CSL77
15CSL77
[As per Choice Based Credit System (CBCS) scheme]
CREDITS – 02
Subject Code - 17CSL77
SEMESTER - VII
Advertisement
WEB TECHNOLOGY LABORATORY WITH MINI PROJECT
17CSL77
Program - 1
Write a JavaScript to design a simple calculator to perform the following operations:
sum, product, difference and quotient
Authentication Successful But Step-2 is Pending. Complete Step-2 to Access Study Materials
Or Logout & Login with an Another Account
You have not logged in to the Future Vision BIE.
Sorry to inform you, Your Account Has been Blocked. By the Admin.
Your User ID: ID
Advertisement
You Have Successfully Logged in.
Welcome,User
Your User ID: ID
Program 1
Write a JavaScript to design a simple calculator to perform the following operations:
sum, product, difference and quotient
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Program 1</title>
<style>
* {
font-size: 25px;
padding: 10px;
}
table,
td,
th {
border: 1px solid blue;
width: 33%;
text-align: center;
background-color: darkkhaki;
}
table {
margin: auto;
}
input {
text-align: center;
width: 300px;
}
</style>
</head>
<body>
<script type="text/javascript">
function calculate(id) {
var val1 = parseFloat(document.getElementById("value1").value);
var val2 = parseFloat(document.getElementById("value2").value);
var result = 0;
if (isNaN(val1) || isNaN(val2)) {
document.getElementById("answer").value = "Error!";
document.getElementById("answer").style.color = "red";
document.getElementById("answer").style.backgroundColor = "yellow";
}
else {
if (id == "+") {
result = val1 + val2;
}
else if (id == "-") {
result = val1 - val2;
}
else if (id == "*") {
result = val1 * val2;
}
else if (id == "/") {
result = val1 / val2;
}
document.getElementById("answer").style.backgroundColor = "green";
document.getElementById("answer").style.color = "white";
document.getElementById("answer").value = result;
}
}
function cls() {
document.getElementById("answer").style.backgroundColor = "white";
clsdis("answer");
clsdis("value2");
clsdis("value1");
}
function clsdis(id) {
document.getElementById(id).value = "";
}
</script>
<table>
<tr>
<th colspan="4">SIMPLE CALCULATOR</th>
</tr>
<tr>
<td>Value 1</td>
<td><input type="number" id="value1"></td>
</tr>
<tr>
<td>Value 2</td>
<td><input type="number" id="value2"></td>
</tr>
<tr>
<td><input type="button" value="Addition" id="+" onclick="calculate(this.id)"></td>
<td><input type="button" value="Subtraction" id="-" onclick="calculate(this.id)"></td>
</tr>
<tr>
<td><input type="button" value="Division" id="/" onclick="calculate(this.id)"></td>
<td><input type="button" value="Multiplication" id="*" onclick="calculate(this.id)"></td>
</tr>
<tr>
<td>Answer: </td>
<td><input type="text" id="answer" value="" disabled></td>
</tr>
<tr>
<td colspan="2"><input type="button" value="Clear Values" id="cls" onclick="cls()"></td>
</tr>
</table>
</body>
</html>
|
Output
Advertisement
×
Note
Page Number is specified to navigate between Pages...
SYS = Syllabus
P = Program
-ADMIN
×
Note
ANY PROBLEM IN Login or Downloading, YOU ARE FREE TO CONTACT US...
-ADMIN
Advertisement
lIKE OUR CONTENT SUPPORT US BY FOLLOWING US ON INSTAGRAM : @futurevisionbie
More Materials will BE UPLOADED "AS SOON AS POSSIBLE"
For immediate Notification Join the Telegram Channel
7th Core Subject
▣ 17CS71 - Web Technology and its applications - WTA
▣ 17CS72 - Advanced Computer Architectures - ACA
▣ 17CS73 - Machine Learning - ML
7th Professional Elective - 3
▣ 17CS741 - Natural Language Processing - NLP
▣ 17CS742 - Cloud Computing and its Applications - CCA
▣ 17CS743 - Information and Network Security - INS
▣ 17CS744 - Unix System Programming - USP
7thProfessional Elective - 4
▣17CS751 - Soft and Evolutionary Computing - SEC
▣17CS752 - Computer Vision and Robotics - CVR
▣ 17CS753 - Digital Image Processing - DIP
▣17CS754 - Storage Area Networks - SAN
7th Lab & Project
▣17CSL76 - Machine Learning Laboratory - ML Lab
▣17CSL77 - Web Technology Laboratory with mini project -
WTA Lab
▣17CSP78 - Project Work Phase–I + Project work Seminar -
Project