Scripting Language Lab Report
Scripting Language Lab Report
Introduction
Client-side scripting refers to the execution of scripts on
the client's web browser rather than on the web server. These scripts are
typically written in languages like JavaScript, which is the most common
client-side scripting language. The main purpose of client-side scripting is
to enhance the interactivity and responsiveness of web pages by allowing
the browser to execute code locally on the user's device.
JavaScript
JavaScript is a versatile and widely used programming language primarily
known for its role in web development. It is a client-side scripting
language that runs in web browsers, allowing developers to create
dynamic and interactive web pages.
Variable declaration
In JavaScript, variables are used to store and manage data, and operators
are used to perform operations on that data. Here are examples of
variable declaration and some common operators in JavaScript.
1. Let
Use “let” when you need to reassign the variable to a different value.
Code
Output
2. const
Use “const” when the variable should never be reassigned after its
initial assignment.
Code
Output
3. Var
In modern JavaScript, it is generally recommended to use “ let” and
“const” over “var” due to scoping differences.
Code
Output
Operators
JavaScript has a variety of operators that allow you to perform operations
on variables and values. Here's an overview of some of the main types of
operators in JavaScript.
Arithmetic Operators
Code Output
Comparison Operators
Code Output
Logical Operators
Code Output
loops:
In JavaScript, loops are used to repeatedly execute a block of
code as long as a certain condition is true. There are several types of
loops available in JavaScript, each with its own use cases. Here's an
overview of the main types of loops.
1. For Loop:
Code: Output:
2. while Loop:
Code: Output:
3. do-while Loop:
Code: Output:
▪
▪
Functions:
A function in JavaScript is a reusable block of code
that can be defined and executed. Functions can take parameters
(inputs), perform tasks, and return a value.
▪ Function Declaration:
Code: Output:
▪ Arrow Function:
Code: Output:
Objects:
Objects in JavaScript are used to store and organize data in
key-value pairs. Objects can have properties and methods.
▪ Object Constructor:
Code: Output:
▪ Object Methods:
Code: Output:
Code: Output:
Event listeners:
In JavaScript, event listeners are used to handle and
respond to events triggered by user interactions or other actions. Event
listeners are attached to HTML elements, and they execute a function
(callback) when the specified event occurs.
Code: Output:
Stop-Watch:
HTML: CSS:
Output:
Server Side Scripting
Introduction:
Server-side scripting is a web server technology in
which a user's request is fulfilled by running a script directly on the web
server to generate dynamic web pages. This is in contrast to client-side
scripting, where scripts are executed by the user's browser. Server-side
scripting allows developers to create dynamic and interactive web
applications by processing data on the server before sending it to the
client's browser.
PHP:
PHP is a server-side scripting language
designed for web development. It can be embedded within HTML code
and is executed on the server. PHP is widely used for creating dynamic
web pages and interacting with databases.
Function:
Code: Output:
Output:
▪ POST Method:
Code: Output:
2. Writing File(Creating):
Code: Output:
Error Handling:
Code: Output:
Cookies:
Code: Output:
Crude Operations:
CRUD stands for Create, Read, Update, and Delete,
which are the basic operations that can be performed on a database.
Here are examples of basic CRUD operations in PHP using MySQL:
Code:
Output:
3. Registration Form:
Code: Output:
4. Retrieving Data:
Code: Output:
Inheritance:
Code:
Output:
Table Of Content
❖ Client Side Scripting (Java Script):
▪ Variable Declaration
▪ let
▪ const
▪ Var
▪ Operators
▪ Arithmetic Operators
▪ Comparison Operators
▪ Logical Operators
▪ loops
▪ For Loop
▪ while Loop
▪ do-while Loop
➢ Event listeners
❖Server Side Scripting(PHP)
➢ Forms Using GET-POST Method:
▪ GET Method
▪ POST Method
➢ File Handling:
▪ Opening File(Reading)
▪ Writing File(Creating)
➢ Crude Operations:
▪ Creating And Connecting DB
▪ Inserting Values in DB
▪ Registration Form
▪ Retrieving Data
➢ Inheritance
➢ Function
➢ Login form With Sanitize and Validation
➢ Error Handling
➢ Cookie