0% found this document useful (0 votes)
7 views5 pages

JavaScript Client-Side Programming Guide

This document is a course outline for a Web Technologies unit in a Computer Science and Engineering program at Anna University, focusing on client-side programming with JavaScript. It covers topics such as JavaScript basics, data types, object models, event handling, and validation methods, along with practical examples and programming exercises. Additionally, it includes a section on JDBC and servlet advantages over CGI.

Uploaded by

keerthidhana14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

JavaScript Client-Side Programming Guide

This document is a course outline for a Web Technologies unit in a Computer Science and Engineering program at Anna University, focusing on client-side programming with JavaScript. It covers topics such as JavaScript basics, data types, object models, event handling, and validation methods, along with practical examples and programming exercises. Additionally, it includes a section on JDBC and servlet advantages over CGI.

Uploaded by

keerthidhana14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

BE- Computer Science and


Engineering

Anna University Regulation:


2021
CCS375- Web
Technologies

III Year/V
Semester
UNIT II CLIENT SIDE
PROGRAMMING

Prepared By,

Mr. Anandakumar.I, AP/CSE


UNIT II CLIENT SIDE PROGRAMMING
Java Script: An introduction to JavaScript–JavaScript DOM Model-Exception Handling-ValidationBuilt-in objects-
Event Handling- DHTML with JavaScript- JSON introduction – Syntax – Function Files.

Part – A

1. What is JavaScript?
JavaScript is a platform-independent, event-driven, interpreted client-side scripting language
developed by Netscape Communications Corp. and Sun Microsystems.
2. What are the primitive data types in javascript?
JavaScript supports five primitive data types: number, string, Boolean, undefined, and null.
These types are referred to as primitive typesbecause they are the basic building blocks from
which more complex types can be built. Of the five, only number, string, and Boolean are real
data types in the sense of actually storing data. Undefinedand null are types that arise under
special circumstances.
3. What are the Escape Codes Supported in JavaScript?
The Escape codes supported in javascript are \b Backspace,\t Tab (horizontal),
\n Linefeed (newline),\v Tab (vertical),\f Form feed,\rCarriage return,\" Double quote \'
Single quote,\\ Backslash.
4. What is JavaScript name spacing? How and where is it used?
Using global variables in JavaScript is evil and a bad practice. That being said, namespacing is
used to bundle up all your functionality using a unique name. In JavaScript, a namespace is
really just an object that you’ve attached all further methods, properties and objects. It
promotes modularity and code reuse in the application.

5. How many looping structures can you find in javascript?


If you are a programmer, you know the use of loops. It is used to run a piece of code multiple
times according to some particular condition. Javascript being a popular scripting language
supports the following loops for, while, do-while loop
6. Mention the various Java Script Object Models.
Math Object, String Object, Date Object, Boolean and Number Object, Document Object
Window Object.
7. How Scripting Language Is Differs from HTML?
HTML is used for simple web page design, HTML with FORM is used for both form design and
Reading input values from user, Scripting Language is used for Validating the given input values
weather it is correct or not, if the input value is incorrect, the user can pass an error message to
the user, Using form concept various controls like
Text box, Radio Button, Command Button, Text Area control and List box can be created.
8. What are the different types of objects in JavaScript?
Implementation Provided
Type Example By Governing Standard
User- Programmer defined Programmer None
defined Customer or Circle
Built-in Array, Math The browser via engine its ECMA-262
JavaScript
Browser Window, Navigator The browser None (though some portions
adhere to an adhoc standard)
Document Image, The browser W3C DOM
HTMLInputElement via its DOM
engine
9. Justify “JavaScript” is an event-driven programming”

Javascript supports event driven programming. when user clicks the mouse or hit the keys on
the keyboard or if user submits the form then these events and response to them can be
handledusing javascript. Hence javascript is mainly used in web programming for validating
the data provided by the user.
10. What is the use of pop up boxes in java script?
There are three types of popup boxes used in javascript. Using these popup boxes the user can
interact with the web application.
11. What is DOM?
Document Object Model (DOM) is a set of platform independent and language neutral
application interface (API) which describes how to access and manipulate the information
stored in XML, XHTML and javascript documents.
12. Enlist any four mouse events.
The MouseEvent are-mousedown, mouseup, mouseover, mousemove, mouseout.
13. List ad various level of document object modeling. Various levels of DOM are DOM0,
Dom1, Dom2, and Dom3

14. What are they validation properties and methods?


Validation properties and methods are checkvalidity (), validaionMessage, customerror,
patternMismatch, rangeOverflow, rangeUnderflow, tooLong.
15. Define event bubbling.
Suppose, there is an element present inside another element. Then during the event handling, if
the event which is present in the inner element is handled and then the event of the outer element
is handled. This process of event handling is called event bubbling
16. How to create arrays in Javascript?We can declare an array like this Var scripts =
new Array(); We can

add elements to this array like thisscripts[0] = "PHP";


scripts[1] = "ASP"; scripts[2] =
"JavaScript"; scripts[3] = "HTML";
Now our array scrips has 4 elements inside it and we can print or access them by using their
index number. Note that index number starts from 0. To get the third element of the array we
have to use the index number 2. Here is the way to get the third element ofan array. document.
write (scripts[2]); We also can create an array like this var no_array = new Array(21, 22, 23,
24, 25);
17. Write a simple program in JavaScript to validate the email-id.

<!DOCTYPE html>
<html>
<head>
<script>
function validateForm() {
var x = [Link]["myForm"]["email"].value;var atpos = [Link]("@");
var dotpos = [Link]("."); if (atpos<1 || dotpos<atpos+2 ||
dotpos+2>=[Link])
{ alert("Not a valid e-mailaddress");
return false;}}
</script> </head>
<body>
<form name="myForm" action="demo_form.asp" onsubmit="return
validateForm();" method="post"> Email: <input type="text" name="email">
<input type="submit" value="Submit">
</form>
</body>
</html>
18. Write short notes on JDBC.
JDBC standard is intented for people developing industrial-strength database
[Link] makes java effective for developing enterprise information [Link]
is the JDBC package that contains classes & interfaces that enable a java program to interact
with a database.
19. Write short notes on JDBC drivers.
A JDBC driver is basically an implementation of the function calls specified in the JDBC API
for a particular vendor’s RDBMS. Hence, a java program with JDBC function calls can access
any RDBMS that has a JDBC driver available. A driver manager is used to keep track of all the
installed drivers on the system. The operations of driver manager are getDriver, registerDriver,
deregisterDriver.
20. What are the advantages of servlet over CGI?
Performance is significantly better, servlet execute within the address space
of aweb server.
Servlets are platform independent
The java security manager on the server enforces a set of restrictions to protect
the resources on a server machine.
The full functionality of java class libraries is available to a servlet.

Part - B
1. How to write function using Java Script? Give Example.
2. Explain sub classes and super classes in Javascript.
3. Discuss Javascript objects in detail with suitable examples.
(NOV/DEC 2012,MAY/JUNE 2014)
4. Discuss about Javascript debugging. Explain how local and global
functions can bewritten using java script (MAY/JUNE 2012)
5. Explain the way in which java script handles arrays with example. (MAY/JUNE 2012)
6. i) Write a Java script to find the factorial of the given number.
ii) Write a Java script to find the prime number between 1 and 100.
7. Write a servlet program which displays the different content each time
the user visits thepage
8. Write a Java script program to create Popup box, alert and confirm box.
9. Write a Java script program to print thenumbers from 0 to 50. b. Write a Java
Script program to create table.
10. Write a Java script program to create user registration form.
11. i) Explain any two validation function in java script.(4)
ii) Write a script to demonstrate the use of Date object.(6)
iii)Write a java script program to generate Fibonacci series using do while loop.(6)
12. i) Explain JavaScript & document object model (DOM ) with example.(8)
ii) Explain in details the JDBC CONNECTIVITY with example program.(8)
Explain the JDBC database access in detail. Write a java servlet to conduct
online examination. (APR/MAY 2013)

You might also like