Client Side Scripting Language (22519) Semester - V (IF) : A Laboratory Manual For
Client Side Scripting Language (22519) Semester - V (IF) : A Laboratory Manual For
Certificate
Institute,………………………………………………………………………………………………
Client Side Scripting languages (22519) for the academic year .............. to
Seal of Institution
Client Side Scripting Languages (22519)
PO 3.Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
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 8.Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
Content Page
Dated
Date of Date of Assessment
Sr.No Title of practical sign of Remarks
performance submission marks(25)
Teacher
Write simple JavaScript with HTML for
1 arithmetic expression evaluation and
message printing.
Develop JavaScript to use decision
2
making and looping statements
Develop JavaScript to implements
3
Array functionalities
Develop javascript to implement
4
functions
Develop javascript to implement
5
Strings.
Create web page using Form Elements
6
Create web page to implement Form
7
Events .Part I
Create web page to implement Form
8
Events .Part II
Develop a webpage using intrinsic
9
java functions
Develop a webpage for creating
session and persistent cookies.
10
Observe the effects with browser
cookies settings.
Develop a webpage for placing the
11 window on the screen and working
with child window.
Develop a web page for validation of
12
form fields using regular expressions.
Create web page with Rollovers
13
effect.
Develop a webpage for implementing
14
Menus.
Develop a webpage for implementing
15
Status bars and web page protection.
Develop a web page for implementing
16
slideshow, banner.
Total
o simple syntax
JavaScript How To
– The HTML <script> tag is used to insert a JavaScript into an HTML page
<script type=“text/javascript”>
</script>
o Optional; required when you want to put multiple statements on a single line
JavaScript can be inserted within the head, the body, or use external JavaScript file
<script type=“text/javascript”>
<!—
document.write(“Hello World!”)
// -->
</script>
JavaScript Variables
In a programming language, variables are used to store data values.
JavaScript uses the var keyword to declare variables.
An equal sign is used to assign values to variables.
<!DOCTYPE html>
<html>
<head>
<title> Alert</title>
</head>
<body>
<script language="JavaScript">
document.write("Hello World!");
alert("Hello World!");
</script>
</body>
</html>
Output: - 1(A)
Output: -1(B)
Syntax
if (condition) {
Syntax
if (condition) {
// block of code to be executed if the condition is true
} else {
// block of code to be executed if the condition is false
Syntax
if (condition1) {
// block of code to be executed if condition1 is true
} else if (condition2) {
// block of code to be executed if the condition1 is false and condition2 is true
} else {
Maharashtra State board of Education
Client Side Scripting Languages (22519)
// block of code to be executed if the condition1 is false and condition2 is false
4. TheSwitch Statement
Use the switch statement to select one of many code blocks to be executed.
Syntax
switch(expression)
{ case x:
// code block
break;
case y:
// code block
break; default:
// code block
JavaScript Loops
1.for loop
Loops are handy, if you want to run the same code over and over again, each time with a different
value.
Syntax:-
for (initialization condition; testing condition; increment/decrement)
{
statement(s)
}
Or for objects
for (variableName in Object)
{
statement(s)
}
Syntax:
do
{
statements..
}while (condition);
3.While loop
A while loop is a control flow statement that allows code to be executed repeatedly based on
a given Boolean condition. The while loop can be thought of as a repeating if statement.
Syntax :
while (boolean condition)
{
loop statements...
}
Output: - 2(A)
Output: - 2(B)
Output: - 2(C)
Output: - 2(D)
Output: - 2(E)
Output: - 2(F)
Creating an Array
Syntax:
var array_name = [item1, item2, ...];
for (i=0;i<emp.length;i++){
document.write(emp[i] + "<br>");
}
</script>
</body>
</html>
2.
<html>
<body>
<script>
varemp=["Sonoo","Vimal","Ratan"];
for (i=0;i<emp.length;i++){
document.write(emp[i] + "<br/>");
}
find() It returns the value of the first element in the given array that satisfies the
specified condition.
findIndex() It returns the index value of the first element in the given array that
satisfies the specified condition.
indexOf() It searches the specified element in the given array and returns the index of
the first match.
lastIndexOf() It searches the specified element in the given array and returns the index
of the last match.
pop() It removes and returns the last element of an
array. push() It adds one or more elements to the end of an
array. reverse() It reverses the elements of given array.
shift() It removes and returns the first element of an array.
sort() It returns the element of the given array in a sorted order.
Output: - 3(A)
Output: - 3(B)
Output: - 3(C)
Output: - 3(D)
Output: - 3(E)