Css Manual PDF
Css Manual PDF
Note: No part of this Lab Manual be reproduced in any form or by any means, without
permission in writing to the Head, Project Institution
K. K. Wagh Polytechnic, Nashik-03
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
Certificate
This is to certify that Mr. / Ms. …………………………………………………..
Seal of
Institution
Institute Vision: - Strive to empower students with Quality Technical Education.
Institute Mission :- Committed to develop students as Competent and Socially Responsible Diploma
Engineers by inculcating learning to learn skills, values and ethics, entrepreneurial attitude, safe and eco-
friendly outlook and innovative thinking to fulfill aspirations of all the stakeholders and contribute in the
development of Organization, Society and Nation.
Department Vision :- (Version – 1.1)
To impart quality technical education for development of technocrats.
Department Mission :- (Version – 1.2)
M1- To provide quality in education and facilities for students to help them to achieve higher academic
career growths.
M2- To impart education to meet the requirements of the industry and society by technological solutions.
M3- Develop technical & soft skill through co–curricular and extra-curricular activities for improving
personality.
Program Educational Objectives:- (Version – 1.2)
PEO1: Provide socially responsible, environment friendly solutions to Computer engineering
related broad-based problems adapting professional ethics.
PEO2: Adapt state-of-the-art Computer engineering broad-based technologies to work in multi-disciplinary
work environments.
PEO3: Solve broad-based problems individually and as a team member communicating effectively in the
world of work
Program Specific Outcome:- (Version – 1.2)
PSO 1: Computer Software and Hardware Usage: Use state-of-the-art technologies for operation and
application of computer software and hardware.
PSO 2: Computer Engineering Maintenance: Maintain computer engineering related software and
hardware systems.
Program Outcomes:- (Version – 1.2)
PO 1: Basic knowledge: Apply knowledge of basic mathematics, sciences and basic engineering to solve
the broad-based Computer engineering problem.
PO 2: Discipline knowledge: Apply Computer engineering discipline - specific knowledge to solve core
computer engineering related problems.
PO 3: Experiments and practice: Plan to perform experiments and practices to use the results to solve
broad -based Computer engineering problems.
PO 4: Engineering tools: Apply relevant Computer technologies and tools with an understanding of the
limitations.
PO 5: The engineer and society: Assess societal, health, safety, legal and cultural issues and the
consequent responsibilities relevant to practice in field of Computer engineering.
PO 6: Environment and sustainability: Apply Computer engineering solutions also for sustainable
development practices in societal and environmental contexts and demonstrates the knowledge
and need for sustainable development.
PO 7: Ethics: Apply ethical principles for commitment to professional ethics, responsibilities and
norms of the practice also in the field of Computer engineering.
PO 8: Individual and team work: Function effectively as a leader and team member in diverse/
multidisciplinary teams.
PO 9: Communication: Communicate effectively in oral and written form.
PO10: Life-long learning: Engage in independent and life-long learning activities in the context of
technological changes in the Computer engineering field and allied industry.
Practical –Course Outcome matrix
Assess
Date of Date of Dated
Sr. Page ment Remarks
Practical Outcome Performa Submis sign of
No. No marks (if any)
nce sion Teacher
(25)
I. Practical Significance
An arithmetic expression is an expression in code that consists of a numeric value. Arithmetic expressions
are extremely important in fundamental computer syntax because they provide numeric values that
support code functions. Message printing is an important part which is used for displaying outputs.
V. Practical Outcome(Pros)
Arithmetic Expressions:
An operator, in computer programing, is a symbol that usually represents an action or process.
These symbols were adapted from mathematics and logic. An operator is capable of manipulating
a certain value or operand. Arithmetic operators perform Arithmetic Operations on numbers
(literals or variables).
Types of Operator:
JavaScript supports the following Arithmetic Operators:
1. Alert Dialog Box : An alert dialog box is mostly used to give a warning message to the
users. For example, if one input field requires to enter some text but the user does not
provide any input, then as a part of validation, you can use an alert box to give a warning
message.
2. Confirmation Dialog Box: A confirmation dialog box is mostly used to take user's consent
on any option. It displays a dialog box with two buttons: OK and Cancel. If the user clicks
on the OK button, the window method confirm() will return true. If the user clicks on the
Cancel button, then confirm() returns false.
Syntax: var retVal = prompt("Enter your name : ", "your name here");
IX. Precautions
1. Software
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
1. Write a program to read arithmetic expression from user, evaluate it and display the
answer using alert box.
2. Write a program to accept the name from user using prompt box and display a
message in format “Good Morning Adam” using alert box.
Blank Pages to Write
Blank Pages to Write
XV. References/Suggestions for further reading:-
1. https://www.w3schools.com/js/js_arithmetic.asp
2. https://codesjava.com/arithmetic-operators-javascript-js
3. https://www.digitalocean.com/community/tutorials/how-to-do-math-in-javascript-
with-operators
4. https://www.javatpoint.com/javascript-operators
Marks Obtained
I. Practical Significance
Decision making statements play an important role in deciding the flow of the program. It
includes statements of if, if-else and switch case. Also when the statements are to be executed
number of times then such iterations can be implemented using loops. Loops supported by
JavaScript includes for, for..in, while and do-while
V. Practical Outcome(Pros)
Loops in JavaScript:
a. FOR LOOP: Choose a for loop if you know in advance how many times your script
should run.
Syntax:
for (var=startvalue; var<=endvalue; var=var+increment)
{
//code to be executed
}
b. FOR..IN LOOP: The for/in statement loops through the properties of an object.
The block of code inside the loop will be executed once for each property.
Syntax:
for (var in object)
{
code block to be executed
}
c. WHILE LOOP: If you don’t know the exact number of times your code is supposed
to execute, use a while loop. With a while loop your code executes while a given
condition is true; as soon as this condition evaluates to false, the while loop stops.
Syntax:
while (variable <= endvalue)
{
//code to be executed
}
d. DO..WHILE LOOP : This kind of loop is similar to the while loop. The difference
between the two is this: In the case of the while loop, if the test condition is false from the
start, the code in the loop will never be executed. In the case of the do ... while loop, the
test condition is evaluated after the loop has performed the first cycle. Therefore, even if
the test condition is false, the code in the loop will execute once.
Syntax:
do
{
//code to be executed
} while (variable <= endvalue)
2 Software
XI Result:
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
1. https://www.w3schools.com/js/js_switch.asp
2. https://www.w3schools.com/js/js_loop_for.asp
3. https://www.teaching-materials.org/javascript/exercises/forloops
I. Practical Significance
An array is a special variable, which can hold more than one value at a time. An array can
hold many values under a single name, and you can access the values by referring to an index
number.
A. Basics of Array:
- An array is a numbered group of data items that you can treat as a single unit.
- For example, you might use an array called scores to store several scores for a
game.
- Arrays can contain strings, numbers, objects, or other types of data.
- Each item in an array is called an element of the array
B. Declaring & Initialising Array
Syntax :
name_of_array = new Array(size_of_array)
Eg : scores = new Array(4);
Assigning values to array
To assign a value to the array, you use an index in brackets. Indexes begin with 0
scores[0] = 39;
scores[1] = 40;
scores[2] = 100;
scores[3] = 49;
Initialising an array
An array can be initialised at the time of declaration also.
scores = new Array(39,40,100,49);
In JavaScript 1.2 and later, you can also use a shorthand syntax to declare an array
and specify its contents.
The following statement is an alternative way to create the scores array:
scores = [39,40,100,49];
The map() method creates a new array by performing a function on each array
element.
The map() method does not execute the function for array elements without values.
The map() method does not change the original array.
var numbers1 = [45, 4, 9, 16, 25];
var numbers2 = numbers1.map(myFunction);
function myFunction(value) {
return value * 2;
}
2. using Array.filter()
The filter() method creates a new array with array elements that passes a test.
var numbers = [45, 4, 9, 16, 25];
var over18 = numbers.filter(myFunction);
function myFunction(value, index, array) {
return value > 18;
}
E. Methods used with Arrays
1. Push : It is used for adding elements at end of array
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
2. Unshift :It is used for adding elements at beginning of array
var list = ["foo", "bar"];
list.unshift("baz", "qux");
["baz", "qux", "foo", "bar"] // result
3. Splice: it is used for adding elements in between
var list = ["foo", "bar"];
list.splice( 1, 0, "baz"); // at index position 1, remove 0 elements, then add "baz"
to that position
["foo", "baz", "bar"]
4. Concat: it is used for adding array to another array
var list = ["foo", "bar"];
var newlist = list.concat( ["baz", "qux"] );
["foo", "bar", "baz", "qux"] // newlist result
5. Add an Array Element at a Particular Index
var list = ["foo", "bar"];
list[2] = "baz"; // add element "baz" to the index position 2 in the array
list[3] = "qux";
["foo", "bar", "baz", "qux"] // result
6. Sort: This method is used to sort the array elements
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();
7. Reverse: This method is used to reverse an array
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();
fruits.reverse();
8. Join: This method returns the array as a string. The elements will be separated by
a specified separator. The default separator is comma (,).
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var energy = fruits.join(" and ");
o/p Banana and Orange and Apple and Mango
9. Pop:It removes the last element from an array
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop(); // Removes the last element ("Mango") from fruits
10. Shift: This method removes the first array element and "shifts" all other elements
to a lower index.
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift(); // Removes the first element "Banana" from fruits
11. Unshift: This method adds a new element to an array (at the beginning), and
"unshifts" older elements:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.unshift("Lemon"); // Adds a new element "Lemon" to fruits
12. Delete is used to delete element from array
var fruits = ["Banana", "Orange", "Apple", "Mango"];
delete fruits[0]; // Changes the first element in fruits to undefined
13. Splice : This method can be used to add new items to an array:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2, 0, "Lemon", "Kiwi");
New Array:
Banana,Orange,Lemon,Kiwi,Apple,Mango
14. Slice: This method slices out a piece of an array into a new array. The slice()
method creates a new array. It does not remove any elements from the source
array.
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var citrus = fruits.slice(1);
o/p Orange,Lemon,Apple,Mango
IX. Precautions
X. Resources Used
2. Software
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
XIV. Exercise:-
1. https://www.w3schools.com/js/js_arrays.asp
2. https://developer.mozilla.org/en-US/ docs/ Web/ JavaScript/ Reference/
Global_Objects/Array
I. Practical Significance
Example:
function myFunction(p1, p2) {
return p1 * p2;
}
b. Function Invocation
The code inside the function will execute when "something" invokes (calls) the
function:
• When an event occurs (when a user clicks a button)
• When it is invoked (called) from JavaScript code
• Automatically (self invoked)
• You can reuse code i.e define the code once, and use it many times.
• You can use the same code many times with different arguments, to produce
different results
IX. Precautions
X. Resources Used
2. Software
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
XIV. Exercise:-
1. https://www.w3schools.com/js/js_functions.asp
2. https://codeburst.io/javascript-functions-understanding-the-basics-207dbf42ed99
I. Practical Significance
JavaScript strings are used for storing and manipulating text.he String object lets you work
with a series of characters; it wraps JavaScript’s string primitive data type with a number of
helper methods.
A. Basics of String:
- In computer programming, a string is traditionally a sequence of characters, either
as a literal constant or as some kind of variable
- Depending on programming language and precise data type used, a variable
declared to be a string may either cause storage in memory to be statically
allocated for a predetermined maximum length or employ dynamic allocation to
allow it to hold a variable number of elements.
D. Special characters
IX. Precautions
X. Resources Used
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
XIV. Exercise:-
1. https://www.w3schools.com/js/js_arrays.asp
2. https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Array
Syntax:
<form name=“myform” action=“/myserverPage” method= “GET” target=“_blank”>
</form>
1. Text:
2. Textarea:
• This is used when the user is required to give details that may be longer than a single
sentence.
• Multi-line input controls are created using HTML <textarea> tag.
3. Button:
• Checkboxes are used when more than one option is required to be selected.
• They are also created using HTML <input> tag but type attribute is set to checkbox.
5. Radio button:
Radio buttons are used when out of many options, just one option is required to be
selected.
They are also created using HTML <input> tag but type attribute is set to radio.
6. Select elements.
A select box, also called drop down box which provides option to list downvarious
options in the form of drop down list, from where a user can select one or more
options.
Conclusion: We understand that how to create a webpage using form elements JavaScript.
Create a webpage using Form Elements:
<html>
<div class="container">
<form >
VII. Precautions
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
XIV. Exercise:-
1. https://www.w3schools.com/js/js_form.asp
2. https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Form
An event is something that happens when user interact with the web page, such as when he clicked
a link or button, entered text into an input box or textarea, made selection in a select box, pressed
key on the keyboard, moved the mouse pointer, submits a form, etc. In some cases, the Browser itself
can trigger the events, such as the page load and unload events.
When an event occur, you can use a JavaScript event handler (or an event listener) to detect them
and perform specific task or set of tasks. By convention, the names for event handlers always begin
with the word "on", so an event handler for the click event is called onclick, similarly an event
handler for the load event is called onload, event handler for the blur event is called onblur, and so
on.
A JavaScript event is an action that can be detected by JavaScript. Many of them are
initiated by user action but the browser generates some.
Event is triggered & then it can be caught by JavaScript functions, which then do
something response.
Event handler is a script that are executed in response to these events. Event handler enables
the web documents to respond the user activities through the browser window.
A form event is fired when a form control receive or loses focus or when the user modify a form
control value such as by typing text in a text input, select any option in a select box etc. Here're
some most important form events and their event handler.
The focus event occurs when the user gives focus to an element on a web page. You
can handle the focus event with the onfocus event handler.
The blur event occurs when the user takes the focus away from a form element or a window. You
can handle the blur event with the onblur event handler.
You can handle the change event with the onchange event handler.
The submit event only occurs when the user submits a form on a web page. You
can handle the submit event with the onsubmit event handler.
Document/Window Events:
Events are also triggered in situations when the page has loaded or when user resize the
browser window, etc. Here're some most important document/window events and their event
handler.
The load event occurs when a web page has finished loading in the web browser. You
can handle the load event with the onload event handler.
The unload event occurs when a user leaves the current web page. You
can handle the unload event with the onunload event handler.
The resize event occurs when a user resizes the browser window. The resize event also occurs in
situations when the browser window is minimized or maximized.
You can handle the resize event with the onresize event handler.
.
Programs on Various event handler.
<!DOCTYPE html>
<html>
<body onload="myFunction()">
<h1>Hello World!</h1>
<script>
function myFunction()
{
alert("Page is loaded");
}
</script>
</body>
</html>
******************************** OUTPUT
*************************************
JavaScript on onclick event handler.
<!DOCTYPE html>
<html>
<body>
<button onclick="document.getElementById('demo').innerHTML=Date()">The time
is?</button>
<p id="demo"></p>
</body>
</html>
******************************** OUTPUT
*************************************
JavaScript on onblur event handler.
<!DOCTYPE html>
<html>
<body>
<p>When you leave the input field, a function is triggered which transforms the input text to
upper case.</p>
<script>
function myFunction()
{
var x = document.getElementById("fname"); x.value
= x.value.toUpperCase();
}
</script>
</body>
</html>
******************************** OUTPUT
*************************************
JavaScript on onblur & onfocus event handler.
<!DOCTYPE html>
<html>
<body>
<p>When you enter the input field (child of FORM), a function is triggered
which sets the background color to yellow. When you leave the input field, a
function is triggered which removes the background color.</p>
<form id="myForm">
<input type="text" id="myInput">
</form>
<script>
var x = document.getElementById("myForm");
x.addEventListener("focus", myFocusFunction,
true); x.addEventListener("blur",
myBlurFunction, true); function
myFocusFunction() {
document.getElementById("myInput").style.backgroundColor = "yellow";
}
function myBlurFunction() {
document.getElementById("myInput").style.backgroundColor = "";
}
</script>
</body>
</html>
******************************** OUTPUT
*************************************
VI. Resources required
VII. Precautions
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
XIV. Exercise:-
1. Formhttps://www.w3schools.com/js/js_form.asp
2. https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/FormEvents
Event:
Mouse Event are used to capture the interaction made by the user by using mouse.
If the user clicks on an element no less than three mouse events fire, in this order:
2. Dblclick:
The dblclick event is rarely used. Even when you use it, you should be sure never to register both an
onclick and an ondblclick event handler on the same HTML element. Finding out what the user has
actually done is nearly impossible if you register both.
3. Mousemove:
The mousemove event works fine, but you should be aware that it may take quite some system time
to process all mousemove events. If the user moves the mouse one pixel, the mousemove event
fires. Even when nothing actually happens, long and complicated functions take time and this may
affect the usability of the site: everything goes very slowly, especially on old computers.
In a layer-based navigation you may need to know when the mouse leaves a layer so that it can be
closed. Therefore you register an onmouseout event handler to the layer. However, event bubbling
causes this event handler to fire when the mouse leaves any element inside the layer, too.
Take another look at the example, switch the mouseovers on and try them. The example adds an
onmouseover event handler to ev3 only. However, you’ll notice that a mouseover event takes place
not only when the mouse enters ev3's area, but also when it enters the area of ev4 or the span. In
Mozilla before 1.3, the event even fires when the mouse enters the area of a text!
The reason for this is of course event bubbling. The user causes a mouseover event on ev4. There is
no onmouseover event handler on this element, but there is one on ev3. As soon as the event has
bubbled up to this element, the event handler is executed.
Microsoft has another solution. It has created two new events mouseenter and mouseleave. They are
almost the same as mouseover and mouseout except that they don’t react to event bubbling.
Therefore they see the entire HTML element they’re registered to as one solid block and don’t react
to mouseovers and –outs taking place inside the block.
Key Events:
Key Event are used to capture the interaction made by the user by using key.
The keydown event occurs when the user presses down a key on the keyboard. You can
The keyup event occurs when the user releases a key on the keyboard. You
can handle the keyup event with the onkeyup event handler.
The keypress event occurs when a user presses down a key on the keyboard that has a character value
associated with it. For example, keys like Ctrl, Shift, Alt, Esc, Arrow keys, etc. will not generate a
keypress event, but will generate a keydown and keyup event.
<!DOCTYPE HTML>
<html>
<head>
<title>Example: Working with Mouse events</title>
<style>
body{font-family:Verdana; background:#44c767;
color:#fff;}
</style>
<script>
var count = 0; function
tracker(){ count++;
alert(count + " Mouse moves have been registered");
}
function popup1() {
alert("Event Registered : onMouseOver");
}
function popup2() {
alert("Event Registered : onMouseOut");
}
</script>
</head>
<body>
<p>Move the mouse over the link to trigger the event
<a href="#" onmouseover="popup1()"> onMouseOver</a></p>
<!DOCTYPE HTML>
<html>
<head>
<title>Example: Working with form Events</title>
<style type="text/css">
p{font-family:Verdana;
background:#FA8B7C;
color:#fff;
padding:10px; border:4px solid #555;}
</style>
</head>
<body>
<form>
<p>
<label for="name"> Subject Name:
<input autofocus id="name" name="name" /></label>
</p>
<p>
<label for="nick"> Subject Abbrivation:
<input id="nick" name="nick" /></label>
</p>
<button type="submit">Submit</button>
</form>
<span id="output"></span>
</body>
<script>
var items = document.getElementsByTagName("input"); for
(var i=0; i < items.length; i++){
items[i].onkeyup = keyboardEventHandler;
}
function keyboardEventHandler(e){
document.getElementById("output").innerHTML = "Key pressed is: " +
e.keyCode + " Char:" + String.fromCharCode(e.keyCode);
}
</script>
</html>
******************************** OUTPUT
*************************************
VII. Precautions
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
XIV. Exercise:-
1. Write a program to design a form and handle any 2 mouse Events.
2. Write a program to design a form and handle any 2 Key Events.
Blank Pages to Write
Blank Pages to Write
XV. References/Suggestions for further reading:-
1. Formhttps://www.w3schools.com/js/js_formevents.asp
2. https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/FormEvents
JavaScriprt provides some special set of built in function known sa Intrinsic function.
The JavaScript provides the intrinsic function for Submit & Reset Button. It can be used
while submitting the form or resetting the form fields.
The submit() method of the form object can be used to send the form to the server in
exactly same way as if the user has pressed the submit button.
Disabling Elements:
If disabled property of particular form element is set to true then user cannot edit that
element. Similarly, on setting property to false we can edit the field.
An element can be disabled in HTML by setting property to true & enabled again by
setting disabled= false.
Some time we need to set some value to a field which user should not change.
To restrict user form changing the value of particular field we make the element readonly by
setting readonly= true.
<html>
<body>
<form name="myform">
Roll Number : <input type= "text" name="roll"/><br><br/> Name :
<input type= "text" name="name"/><br><br/>
<img src= "Submit.png" onclick
="javascript:document.forms.myforms.submit()"/><br><br/>
<img src= "Reset.png" onclick
="javascript:document.forms.myforms.submit()"/><br><br/>
</form>
</body>
</html>
******************************** OUTPUT
*************************************
JavaScript on Disabling Elements.
<html>
<script language="JavaScript"> function
Disable()
{
documents.forms.myform.name.disabled= true;
}
function Enable()
{
documents.forms.myform.name.disabled=false;
}
</script>
<form name="myform">
User Name : <input type= "text" name="name"/><br><br/>
<input type= "button" value="Disable Name Field" onclick="Disable()"/><br><br/>
<input type= "button" value="Enable Name Field"
onclick="Enable()"/><br><br/>
</form>
</body>
</html>
******************************** OUTPUT
*************************************
JavaScript Read Only Elements.
<html>
<head>
<script type="text/javascript">
function
ToggleReadOnlyState () {
var textarea = document.getElementById ("myText");
textarea.readOnly = !textarea.readOnly;
}
</script>
</head>
<body>
<textarea id="myText" rows="3" readonly="readonly">Change this
text!</textarea>
<br />
Click on the button to modify the editable state of the textarea element
<br />
<button onclick="ToggleReadOnlyState ();">Change read-only state!</button>
</body>
</html>
******************************** OUTPUT
*************************************
VI. Resources required
Sr. No. Name of Specification Quantity Remarks
Resource
1 Computer Operating System: Windows 7 or
System higher Memory: 2 GB RAM or higher
Processor Speed: Intel core i3 or
higher Hard Drive: 500 GB or larger
2 Software Notepad++, Chrome
VII. Precautions
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
I. Practical Significance
Cookies are data, stored in small text files, on your computer. Cookies remember information about the
user. When a browser requests a web page from a server, cookies belonging to the page are added to the
request. This way the server gets the necessary data to "remember" information about users.
B. Contents of Cookie
Cookies are a plain text data record of 5 variable-length fields −
• Expires − The date the cookie will expire. If this is blank, the cookie will expire when
the visitor quits the browser.
• Domain − The domain name of your site.
• Path − The path to the directory or web page that set the cookie. This may be blank if
you want to retrieve the cookie from any directory or page.
• Secure − If this field contains the word "secure", then the cookie may only be retrieved
with a secure server. If this field is blank, no such restriction exists.
• Name=Value − Cookies are set and retrieved in the form of key-value pairs
C. CREATING A COOKIE
• JavaScript can create, read, and delete cookies with the document.cookie property.
Eg : document.cookie = "username=John Doe";
• You can also add an expiry date (in UTC time). By default, the cookie is deleted when the
browser is closed:
Eg : document.cookie = "username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 UTC";
• With a path parameter, you can tell the browser what path the cookie belongs to. By default,
the cookie belongs to the current page.
Eg : document.cookie = "username=John Doe; expires=Thu, 18 Dec 2013 12:00:00
UTC; path=/";
D. READING A COOKIE
• Reading a cookie is just as simple as writing one, because the value of the document.cookie
object is the cookie.
• Use this string whenever you want to access the cookie.
• The document.cookie string will keep a list of name=value pairs separated by semicolons,
where name is the name of a cookie and value is its string value.
E. DELETING A COOKIE
F. TYPES OF COOKIE
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
1. Explain the types of Cookies.
2. Write a function to delete a cookie.
XIV. Exercise:-
1. Write a program to create a session cookie and display content of Cookie.
2. Write a JavaScript that creates persistent cookie.
Blank Pages to Write
Blank Pages to Write
XV. References/Suggestions for further reading:-
1. https://www.w3schools.com/js/js_cookies.asp
XVI. Assessment Scheme:-
Performance Indicators Weightage
1. Use of relevant tags and attributes 10%
2. Correctness of Coding 40%
3. Testing and Debugging of Program 30%
4. Appearance of Program Output 10%
5. Submission of Report on time 10%
Total(50 Marks) 100%
I. Practical Significance
Windows play an important role in websites. Many a times it is required to open and display anew window
for displaying details or for doing some additional work. We can open a small window known as child
window by clicking a button or a link or a image of a main window.
C. The Arguments:
• You have a number of options for the third argument. When you define any of
them, the remaining Boolean values (which can be true/false or yes/no or 1/0) are
all set to false/no/0.
• Whichever you choose to use, all of your options go into the same quoted string,
with commas between the values, and no spaces are allowed between them.
▪ Height: Defines the height of the window in pixels. Percentage values don't
work.
▪ Width: Defines the width. Again, you'll have no joy with percentages.
▪ Left: Supported by version 4 browsers and above, this sets how far removed
the window appears from the left of the screen. In pixels.
▪ Top: Partner to left, this pushes the window off the top of the screen.
▪ Resizable:Set to true or false, this may allow the user to resize the window.
▪ Scrollbars: Another Boolean value, this adds scrollbars to the new window.
If your content may be longer then the dimensions you've specified, make
sure this is set to yes.
▪ Toolbar: Specifies whether the basic back/forward toolbar should be visible.
If there are links to follow in your new page, set this to yes.
▪ Menubar: Specifies whether the main toolbar (File, Edit, ...) is shown.
▪ Location: Specifies whether the location toolbar (address bar) is shown.
▪ Status: Specifies whether the new window can have a status bar. Best set to
yes. For security reasons, Mozilla-based browsers always show the status
bar.
▪ Directories: Specifies whether the directories toolbar is shown (Links toolbar
in IE).
▪ Fullscreen: Internet Explorer-only Boolean attribute which may open the
window in fullscreen. It's annoying — don't use it.
▪ Dependent: Netscape 4-only attribute which makes the popup dependent on
the status of the main window. If the main window is closed, the popup
closes with it.
▪ screenX & screen: Old Netscape attributes for defining the window's position on the
page. Use left and top in their place.
D. The Methods: Following methods can be used with the window object.
Method Description
alert() Displays an alert box with a message and an OK button
atob() Decodes a base-64 encoded string
blur() Removes focus from the current window
btoa() Encodes a string in base-64
clearInterval() Clears a timer set with setInterval()
clearTimeout() Clears a timer set with setTimeout()
close() Closes the current window
confirm() Displays a dialog box with a message and an OK and a Cancel button
focus() Sets focus to the current window
getComputedStyle() Gets the current computed CSS styles applied to an element
getSelection() Returns a Selection object representing the range of text selected by the user
matchMedia() Returns a MediaQueryList object representing the specified CSS media query
string
moveBy() Moves a window relative to its current position
moveTo() Moves a window to the specified position
open() Opens a new browser window
print() Prints the content of the current window
prompt() Displays a dialog box that prompts the visitor for input
requestAnimationFrame() Requests the browser to call a function to update an animation before the next
repaint
resizeBy() Resizes the window by the specified pixels
resizeTo() Resizes the window to the specified width and height
scroll() Deprecated. This method has been replaced by the scrollTo() method.
scrollBy() Scrolls the document by the specified number of pixels
scrollTo() Scrolls the document to the specified coordinates
setInterval() Calls a function or evaluates an expression at specified intervals (in
milliseconds)
setTimeout() Calls a function or evaluates an expression after a specified number of
milliseconds
stop() Stops the window from loading
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
1. Explain any 4 methods used with window object along with their syntax.
2. Write a JavaScript to display digital clock in the new window.
XIV. Exercise:-
1. Write a program to design a form to accept height and width and 3 buttons as “Create Window”,
“Move Window” and “Resize window”
Blank Pages to Write
Blank Pages to Write
XV. References/Suggestions for further reading:-
1. https://www.w3schools.com/jsref/obj_window.asp
2. https://developer.mozilla.org/en-US/docs/Web/API/Window
XVI. Assessment Scheme:-
Performance Indicators Weightage
1. Use of relevant tags and attributes 10%
2. Correctness of Coding 40%
3. Testing and Debugging of Program 30%
4. Appearance of Program Output 10%
5. Submission of Report on time 10%
Total(50 Marks) 100%
I. Practical Significance
A regular expression is an object that describes a pattern of characters. The JavaScript RegExp class
represents regular expressions, and both String and RegExp define methods that use regular expressions
to perform powerful pattern-matching and search-and-replace functions on text. It has wide use in search
and replace applications.
A. Regular Expression
• A regular expression is an object that describes a pattern of characters
• Syntax: A regular expression could be defined with the RegExp () constructor, as follows
var pattern = new RegExp(pattern, attributes);
var pattern = /pattern/attributes;
Here is the description of the parameters −
pattern − A string that specifies the pattern of the regular expression or another regular
expression.
attributes − An optional string containing any of the "g", "i", and "m" attributes that specify
global, case-insensitive, and multi-line matches, respectively
B. Language of Regular Expression
• The words of regular expression are called special character. Various special characters
that can be used in regular expression along with their meaning are shown in following
table:
IX. Precautions
X. Resources Used
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
1. Explain regular expressions with its syntax.
2. Explain the different metacharachters and quantifiers that can be used in regular expression.
XIV. Exercise:-
1. Write a program to perform form validation for a registration form using regular expressions
2. Write a JavaScript to count the number of vowels in a given string using regular expression
3. Write a JavaScript to check whether the first letter if the string is capitalized or not
Blank Pages to Write
Blank Pages to Write
XV. References/Suggestions for further reading:-
1. http://www.tutorialspark.com/javascript/JavaScript_Regular_Expression_Form_Validation.php
2. http://form.guide/snippets/javascript-form-validation-using-regular-expression.html
I. Practical Significance
Rollover is a JavaScript technique used by Web developers to produce an effect in which the appearance
of a graphical image changes when the user rolls the mouse pointer over it. Rollover also refers to a button
on a Web page that allows interactivity between the user and the Web page.It is mainly used by developers
for advertising purpose.
A. Concept of Rollover
• Appears when the user place his or her mouse over the text area and the rollover text changes to
“Rollover means a webpage changes when the user moves his or her mouse over an object on the page”
when the user moves his or her mouse away from the text area.
• Rollover is a JavaScript technique used by Web developers to produce an effect in which the appearance
of a graphical image changes when the user rolls the mouse pointer over it.
• Rollover also refers to a button on a Web page that allows interactivity between the user and the Web
page.
• Rollover effect is mainly used in web page designing for advertising purpose. Rollover is triggered
when the mouse moves over the primary image, causing the secondary image to appear. The primary
image reappears when the mouse is moved away.
B. Creating Rollover
• On many web pages JavaScript rollovers are handled by adding an onmouseover and
onmouseout event on image.
1. onmouseover : event occurs when a mouse pointer comes over an element.
2. onmouseout – event occurs when a mouse pointer leaves an element
C. Text Rollover:
• Text rollover is a technique in which whenever user rollover the text, Javascript
allows to change the page element usually some graphics.
• Suppose user is rolling the cursor over the text, then instead of simply changing
the image we can display more window displaying some features about the item
on which mouse is rolling over. This process is called as Multiple Actions For
Rollover.
• Duo to this effect visitor gets more information at a glance.
• We can open additional window using function Open(). This function is invoking
using the object window.
• The open() method opens a new browser window. The close() window closes the
window..
X. Resources Used
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
1. Explain what s rollover.
2. Which methods are used for generating the rollover effect. State the syntax
XIV. Exercise:-
1. Write a program to demonstrate the example of image rollover
2. Write a program to demonstrate the example of text rollover
3. Write a program to demonstrate the example of image and text rollover
Blank Pages to Write
Blank Pages to Write
XV. References/Suggestions for further reading:-
1. https://www.w3schools.com/jsref/event_onmouseover.asp
2. http://www.dhtmlgoodies.com/tutorials/javascript-rollovers/
I. Practical Significance
The Menu element represents a group of commands that a user can perform or activate. Menu may
contain multiple choices to select. User can choose one or more menu at a time depending on type of
menu. It is an important element to perform navigation.
A. Menu
• Menus are an important element to provide navigations in WebPages
• It provides quick link for browsing the desired web pages
• Different types of Menus can be implemented depending on the requirements
.
B. Types of Menus
• It is possible to open a new window from a JavaScript by simply clicking a button.
1. Pull down Menu : Also called a drop-down menu, a menu of commands or options
that appears when you select an item with a mouse
2. Floating Menu: The menu which is fixed while scrolling the webpage is called as
floating menu. It can be created by setting style position of menu as fixed.
3. Chain Select Menu: A chain of pull-down menus can be created in which the option
selected from the first pull-down menu determines the options that are available in
the second pull-down menu. Likewise, the second pull-down menu selection
determines options that are shown in the third pull-down menu.
4. Tab Menu: Tab menus display a one- or two-word description of the menu option
within a tab. A more complete description is displayed below the tab bar as the
visitor moves the mouse cursor over the tab
5. Popup Menu: A popup menu displays several top-level menu items. A popup menu
appears as the visitor moves the mouse cursor over a top-level menu item. The
popup menu contains lower-level menu items that are associated with the top-level
menu item.
6. Highlighted Menu: A highlighted menu, causes two kinds of highlights to appear
around an item on the menu. When the visitor moves the cursor over a menu item,
the browser displays a box around the item with a shadow at the bottom of the box.
If the visitor selects the item, the highlight shadow appears at the top of the box
rather than at the bottom of the box.
7. Folding Tree Menu: The folding tree menu should look familiar, because it is a
classic menu used in desktop applications to help you to navigate file folders. The
tree consists of one or more closed folders, each of which appears alongside the
folder's name. The tree expands when the visitor clicks a closed folder, showing one
or more menu options that are associated with the folder.
8. Context Menu :The context menu pops up on the web page when the visitor clicks
the right mouse button . The location of the context menu on the screen is
determined by the position of the mouse cursor. The mouse cursor sets the position
of the upper-left corner of the context menu. Each menu item is automatically
highlighted as the visitor scrolls through the menu by moving the mouse cursor. The
visitor clicks the name of the item to select that menu option. The context menu is
hidden from the screen by clicking the mouse cursor away from the menu. You can
link each of these options to another web page or to a bookmark within the web
page that contains the tree menu. The tree collapses when the visitor clicks an open
folder.
9. Scrollable Menu: If you are tight on space and have many menu items to present to
visitors to your web site, the scrollable menu is the solution to your problem. The
scrollable menu displays a limited number of menu item across the web page.
Although only a few items are shown, you can use as many menu items as your
application needs. Two arrowheads appear at both ends of the visible list of menu
items. Visitors can simply move the mouse cursor over one of the arrowheads and
the browser automatically scrolls the menu in the direction of the arrowhead The
visitor can then click the appropriate menu item once it scrolls into view.
10. Side Bar Menu: The side bar menu displays a menu on the side of the web page.
Options on this menu can be linked to other web pages or to other menu options.
11. Slide-In Menu/Sliding Menu: The slide-in menu appears as a vertical block that
floats on the left side of the web page. It seems to come alive when the visitor
moves the mouse cursor over the block.
VIII. Resources required
IX. Precautions
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
1. Explain any 4 methods types of Menu.
2. State the difference between sidebar menu and sliding menu.
XIV. Exercise:-
1. Write a program to design pull down menu using JavaScript.
2. Write a program to design drop down menu using JavaScript.
Blank Pages to Write
Blank Pages to Write
XV. References/Suggestions for further reading:-
1. https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_js_dropdown
2. https://www.w3schools.com/howto/howto_js_dropdown.asp
XVI. Assessment Scheme:-
Performance Indicators Weightage
1. Use of relevant tags and attributes 10%
2. Correctness of Coding 40%
3. Testing and Debugging of Program 30%
4. Appearance of Program Output 10%
5. Submission of Report on time 10%
Total(25 Marks) 100%
I. Practical Significance
The status bar is located at the bottom of the browser window and is used to display a short message to
visitors to your web page. Web page protection plays an important role in securing the data.
A. Status Bars
• A static message appears when the web page opens and remains on the status bar until the
web page is closed.
• The content of the status bar is the value of the window object's status property. To display a
message on the status bar, you'll need to assign the message to the status property of the
window object.
• The following statement assigns a string to the status property, which appears on the status
bar once the browser executes this statement:
• window.status=‘Welcome to Status Bar. This is Static Message.'
B. Protecting web pages:
• The source code of a web page can be viewed by clicking right mouse button on the
webpage.
• Anyone can see the source code of a webpage which is not safe.
• We can hide the code by disabling right mouse click on webpage.
• Hiding source code is nothing but protecting the source code from viewing by other users.
IX. Precautions
X. Resources Used
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
1. Explain security in JavaScript.
2. State the use of status bars
XIV. Exercise:-
1. Write a JavaScript program that creates a scrolling text on the status line of a window.
2. Write a JavaScript program to disable right click of mouse.
Blank Pages to Write
Blank Pages to Write
XV. References/Suggestions for further reading:-
1. https://www.w3schools.com/jsref/prop_win_status.asp
2. https://stackoverflow.com/questions/737022/how-do-i-disable-right-click-on-my-web-page
I. Practical Significance
The banner advertisement is the hallmark of every commercial web page. It is typically positioned near
the top of the web page, and its purpose is to get the visitor's attention. A slideshow is used to cycle
through element.
A. Banner
• The banners should all be the same size so they look professional as they rotate on your web
page.create an image element on your web page using the <img> tag. You'll need to set four
attributes of the <img> tag: src, width, height, and name
• Set the src attribute to the file name of the first banner advertisement that you want to
display. Set the width and height attributes to the width and height of the banner. Set the
name attribute to a unique name for the image element.
• The image element (banner) should be centered in the page using the <center> tag within the
<body> tag of your web page.
• The final step is to build the JavaScript that will rotate the banners on your web page. You'll
define the JavaScript in the <head> tag of the web page. The JavaScript must do the
following:
1. Load banner advertisements into an array.
2. Determine whether the browser supports the image object.
3. Display a banner advertisement.
4.Pause before displaying the next banner advertisement.
C. SlideShow
• A slide show is a presentation of a series of still images on a projection screen or electronic
display device, typically in a prearranged sequence.
• It is generally used for display purpose where a set of images are displayed one after the
another. They may be used to convey information to user in pictorial forms
IX. Precautions
XI Result :
…………………………………………………………………………………………
…………………………………………………………………………………………
XII. Conclusion(s)
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
XIII. Questions:-
1. Explain the use of banners in websites.
2. How to create a slide show in javascript?
Blank Pages to Write
Blank Pages to Write
XIV. Exercise:-
1. Develop a JavaScript Program to Create Rotating Banner Ads with URL Links.
2. Create a slideshow with the group of four images, also simulate the next and previous
transition between slides in your JavaScript.
XV. References/Suggestions for further reading:-
https://javascript-tutor.net/index.php/lesson-28-managing-banner-ads-in-javascript