Web Technology Lab Manual
Assignment No. - 4
TITLE
HTML, Java Script
OBJECTIVES
1. Understand about basic concepts of JavaScript.
2. Use JavaScript for validation of data.
PROBLEM STATEMENT
Write a program to design registration form for students by using HTML, CSS& Java Script and
perform following validations: all fields mandatory, Name,phone number and email address validation.
OUTCOMES
Students will be able to,
1. Design static webpage using HTML.
2. Apply JavaScript to HTML pages for validation of data.
SOFTWARE & HARDWARE REQUIREMENTS
Software’s: Notepad, Any Browser
THEORY-CONCEPT
JavaScript is a programming language of HTML as well web. It is preferred for creating
network-centric applications.It is integrated and complimentary with Java. As JavaScript is
integrated with HTML it is very easy to implement. It is open as well as cross-platform.
Web Technology Lab Manual
Advantages:
The advantages of using JavaScript are −
It requires less server interaction
Immediate feedback to the visitors
Increased interactivity
Richer interfaces
Validation:
When client enters the all necessary data and press the submit button form validation is
done at server side If data entered by a client is incorrect or missing,the server needs to send all
data back to the client and request for resubmission of form with correct information. This is
really a lengthy process which puts a lot of load(burden) on the server.
So, JavaScript provides a way to validate form's data on the client's side itself before sending it
to the web server. Form validation performs two functions-
Basic Validation –First of all the form must be checked to make sure all the mandatory
fields are filled in. It would require just a loop through each field in the form and check
for the data.
Data Format Validation − Secondly, the data that is entered must be checked for correct
format and its value. The code must include appropriate logic to test correctness of data.
TECHNOLOGY/TOOL
JavaScript can be implemented using JavaScript statements that are placed within the <script>.
You can place the <script> tags, containing your JavaScript, anywhere within your web page,
but it is normally recommended that you should keep it within the <head> tags.
The script tag takes two important attributes:
Language − This attribute specifies what scripting language you are using. Typically, its
value will be JavaScript. Although recent versions of HTML (and XHTML, its
successor) have phased out the use of this attribute.
Type − This attribute is what is now recommended to indicate the scripting language in
use and its value should be set to "text/javascript".
Web Technology Lab Manual
DESIGN/EXECUTION STEPS
Following steps are used to Create and Execute web applications,
1. Write an HTML code in notepad and save with .html extension.
2. First Program is of Login- if uname and password is correct it will redirect to enquiry form and
if incorrect will give alert message.
3. Write the function for validation of name, email id and phone no and enclosed this
function in script in enquiry.html.
4. Call this function on ‘onsubmit’ event of submit button.
5. Open HTML page in the browser.
TEST CASES
Manual testing is used to check following validations
All the fields like Name, Address, Phone number,DOB,Gender and email id are
mandatory fields.
Name should be characters only.
Phone no. should be numbers only.
Email id should be in proper format like abc@abc.com
CONCLUSION/ANALYSIS
Hence, we applied validate the data using JavaScript.
ORAL QUESTIONS
1. Name some Java Script features.
2. How to define anonymous function?
3. What is callback?
4. What is the difference between undefined and not-defined in JavaScript?
5. What is ‘closure’ in JavaScript?
6. What are JavaScript data types?
7. What are all the types of Pop up boxes available in JavaScript?