0% found this document useful (0 votes)
10 views7 pages

WEB5

Dialog Box

Uploaded by

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

WEB5

Dialog Box

Uploaded by

Satyam Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

WORKSHEET (Experiment 5)

Student Name: Satyam Kumar UID: 24MCA20083


Branch: MCA General Section / Group: 24MCA 2 & “A”
Semester: 1st Date of Performance: 21-10-2024
Subject Name: Web Programming Subject Code: 24CAP-605
Lab

Aim
• WAP to demonstrate dialog boxes in JavaScript.
• WAP to demonstrate cookies in JavaScript.
• WAP to create form to submit user records and validate data.

Overview

What is JavaScript?
JavaScript is a programming language used for creating dynamic content on websites.
It is a lightweight, cross-platform and single-threaded programming language.
JavaScript is an interpreted language that executes code line by line providing more
flexibility.
It is a commonly used programming language to create dynamic and interactive
elements in web applications. It is easy to learn.

Hello World Program in JavaScript


console.log ("Hello World!);
DIALOG BOX
Dialogue boxes are a kind of popup notification, this kind of informative functionality
is used to show success, failure, or any particular/important notification to the
user.JavaScript uses 3 kinds of dialog boxes:
▪ Alert:
o Displays a message in a dialog box.
o It only has an "OK" button.
o Used to inform the user of something without requiring any input.

▪ Prompt
o Displays a dialog box that asks the user for input.
o It returns the input entered by the user, or null if the user cancels the
input.
▪ Confirm

o Displays a dialog box with a message, along with "OK" and "Cancel"
buttons.
o Returns true if the user clicks "OK" and false if the user clicks "Cancel."

These dialog boxes can be of very much help in making our website look more
attractive.

COOKIES
A cookie is an amount of information that persists between a server-side and a client-
side. A web browser stores this information at the time of browsing.
A cookie contains the information as a string generally in the form of a name-value
pair separated by semi-colons. It maintains the state of a user and remembers the
user's information among all the web pages.
JAVASCRIPT FORM VALIDATION
It is important to validate the form submitted by the user because it can have
inappropriate values. So, validation is must to authenticate user.JavaScript provides
facility to validate the form on the client-side so data processing will be faster than
server-side validation.
Most of the web developers prefer JavaScript form validation. Through JavaScript, we
can validate name, password, email, date, mobile numbers and more fields.

IMPLEMENTATION
(HTML + JAVASCRIPT Code)
OUTPUT:
Learning Outcomes (What I have Learnt):
✓ Learned to use alert(), confirm(), and prompt() methods to interact with users and
handle input.
✓ Learned to set, retrieve, and delete cookies in the browser to store user-specific data.
✓ Learned to create and validate a form to ensure that user inputs are complete and in
the correct format.

You might also like