Assign 4
Assign 4
Assignment No. - 04
TITLE
OBJECTIVES
PROBLEM STATEMENTS
OUTCOMES
a) Design calculator interface like text field for input and output, buttons for numbers and
operators etc.
SOFTWARE NEEDED
Page 25
Web Technology Lab Manual
THEORY - CONCEPT
HTML is a text file containing specific syntax, file and naming conventions that show the computer
and the web server that it is in HTML and should be read as such. By applying these HTML
conventions to a text file in virtually any text editor, a user can write and design a basic webpage, and
then upload it to the internet.
The most basic of HTML conventions is the inclusion of a document type declaration at the
beginning of the text file. This always comes first in the document, because it is the piece that
affirmatively informs a computer that this is an HTML file. The document header typically looks like
this: <!DOCTYPE html>. It should always be written that way, without any content inside it or
breaking it up. Any content that comes before this declaration will not be recognized as HTML by a
computer.
Example:-
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Page 26
Web Technology Lab Manual
1. Internal CSS
The Internal CSS has <style> tag in the <head> section of the HTML document. This CSS style
is an effective way to style single pages.
2. External CSS
In external CSS, we link the web pages to the external .css file. It is created by text editor. The CSS
is more efficient method for styling a website. By editing the .css file, we can change the whole site at
once.
2. Inline CSS
Inline CSS is used to style a specific HTML element. Add a style attribute to each HTML tag
without using the selectors
1. <!DOCTYPE html>
2. <html>
3. <body style="background-color:white;">
4. <h1 style="color:Red;padding:20px;">CSS Tutorials</h1>
5. <p style="color:blue;">It will be useful here.</p>
6. </body>
7. </html>
Page 27
Web Technology Lab Manual
Javascript
JavaScript is a dynamic programming language that's used for web development, in web
applications, for game development, and lots more.
It allows you to implement dynamic features on web pages that cannot be done with only
HTML and CSS.
JavaScript (js) is a light-weight object-oriented programming language which is used by
several websites for scripting the webpages.
It is an interpreted, full-fledged programming language that enables dynamic interactivity on
websites when applied to an HTML document.
Features of JavaScript
There are following features of JavaScript:
1. All popular web browsers support JavaScript as they provide built-in execution environments.
2. JavaScript follows the syntax and structure of the C programming language. Thus, it is a structured
programming language.
3. JavaScript is a weakly typed language, where certain types are implicitly cast (depending on the
operation).
4. JavaScript is an object-oriented programming language that uses prototypes rather than using classes
for inheritance.
5. It is a light-weighted and interpreted language.
6. It is a case-sensitive language.
7. JavaScript is supportable in several operating systems including, Windows, macOS, etc.
8. It provides good control to the users over the web browsers.
Example :
<script>
</script>
Page 28
Web Technology Lab Manual
TEST CASES
Manual testing is used to validate the fields like username, password, mobile number and email
id’s of the users entered by user is in correct format.
CONCLUSION / ANALYSIS
Hence, we have performed the javascript program to develop a calculator for performing operations
like addition,subtraction,multiplication,etc.
Page 29
Web Technology Lab Manual
HTML CODE
calc.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Simple Calculator using HTML, CSS and JavaScript</title>
<link rel="stylesheet" href="calc.css">
</head>
<body>
</body>
</html>
Page 31
Web Technology Lab Manual
CSS FILE
calc.css
@import url('https://fonts.googleapis.com/css2?family=Orbitron&display=swap');
.calculator {
padding: 10px;
border-radius: 1em;
height: 380px;
width: 400px;
margin: auto;
background-color: #191b28;
box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
}
.display-box {
font-family: 'Orbitron', sans-serif;
background-color: #dcdbe1;
border: solid black 0.5px;
color: black;
border-radius: 5px;
width: 100%;
height: 65%;
}
#btn {
background-color: #fb0066;
}
input[type=button] {
font-family: 'Orbitron', sans-serif;
background-color: #64278f;
color: white;
border: solid black 0.5px;
width: 100%;
border-radius: 5px;
Page 32
Web Technology Lab Manual
height: 70%;
outline: none;
}
input:active[type=button] {
background: #e5e5e5;
-webkit-box-shadow: inset 0px 0px 5px #c1c1c1;
-moz-box-shadow: inset 0px 0px 5px #c1c1c1;
box-shadow: inset 0px 0px 5px #c1c1c1;
}
Page 33
Web Technology Lab Manual
JAVASCRIPT CODE
calc.js
// This function clears all the values
function clearScreen() {
document.getElementById("result").value = "";
}
Page 34
Web Technology Lab Manual
OUTPUT
Page 35
Web Technology Lab Manual
ORAL QUESTIONS
1. What is HTML ?
2. What is CSS ?
3. What is the Javascript ?
4. Understand the use of prompt and alert window using Java Script .
5. Explain JS validation.
Page 36