Experiment No - 2 Aim: Theory

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

EXPERIMENT NO – 2

AIM: To create a HTML page using Internal style in CSS.


THEORY:
Cascading Style Sheets (CSS) is a simple mechanism for
adding style to Web documents. CSS is designed to enable
the separation of presentation and content, including layout,
colors, and fonts. This separation can improve content
accessibility, provide more flexibility and control.
Inline CSS: An inline CSS is used to apply a unique style
to a single HTML element. An inline CSS uses the style
attribute of an HTML element.
Internal CSS: An internal CSS is used to define a style
for a single HTML page. It is defined in the <head>
section of an HTML page, within a <style> element.
Example:
<head>
<style>
body {background-color: powderblue;}
h1{color: blue;}
p{color: red;}
</style>
</head>
RESULT : We successfully created a HTML Page applying
Internal style CSS
EXPERIMENT NO – 3
AIM: To create a webpage using external CSS
THEORY:
An external style sheet is used to define the style for
many HTML pages. With an external style sheet, you can
change the look of an entire web site, by changing one file.
To use an external style sheet, add a link to it in the
<head> section of each HTML page. The external style
sheet can be written in any text editor. The file must not
contain any HTML code, and must be saved with a .css
extension.
Example:
Eg. style.css
body {
background-color: powderblue;
}
h1 {
color: blue;
}
p{
color: red;
}
RESULT : We successfully created a HTML Page applying
External style CSS.
EXPERIMENT NO – 4
AIM: To write a java script program that performs
validation.
THEORY:
HTML form validation can be done by Java script.
If a form field 9frame) is empty, this function alerts a
message, and returns false, to prevent the form from
being submitted.
Function validation form() {Var x= document form[“my
form”][“name”].value;If (x=” “) alert (“Name must
be filled”);return false;}}
Data Validation is the process of ensuring that user input is
clean, correct and useful.
Typical validation tasks are:
o Has the value filled n all required fields?
o Has the user entered a valid date?
o Has the user entered text in numeric field?
Server side validation is performed by web server, after
input has been sent to server.
Client side validation is performed by web browser, before
input is sent to the web server.
RESULT : We have successfully created a form using Java
Script.
EXPERIMENT 5
AIM: To write a program in Java script
1. Current date and time
2. To show online exam
THEORY:
Current Date and Time:
BY default Java script will be the browser’s time zone
and display a text as a full text string.
Sun June 06 2021 18:55:55 GMT+0530 IST
To show online exam:
Java script provides facility to validate the form on the
client side. In data processing will be faster than sown
like validation.
Form Validation generally performs 2 functions.
-> Basic validator:- First of all form must be checked to
make sure all mandatory fields are filled in , it would
require just a loop through each field in the form and
check for the data.
-> Data Form Validation:- Data that is entered must be
checked for correct form and value. Your code must
include appropriate logic to test correctness of data.
RESULT : We successfully created a Javascript webpage to
display current time & date and to show online exam.
EXPERIMENT NO – 6
AIM : Write a Program to invoke servlets from HTML Page
THEORY:
Servlet technology is used to create a web application
(resides at server side and generates a dynamic web
page).Servlet technology is robust and scalable because
of java language. There are many interfaces and classes
in the Servlet API such as Servlet, GenericServlet,
HttpServlet, ServletRequest, ServletResponse, etc.
Servlets are platform independent. Servlets execute within
the address space of a Web server. It is not necessary to
create a separate process to handle each client
request.The full functionality of the Java class libraries
is available to a servlet.
HTTP Requests:
The request sent by the computer to a web server,
contains all sorts of potentially interesting information; it is
known as HTTP requests.The HTTP request methods are
performed on the resource identified by the Requested URI.
Methods include GET,POST,PUT,DELETE,HEAD,TRACE.
POST METHOD: Asks the server to accept the body info
attached.large amount of data can be sent because data
is sent in body.Post request is secured because data is not
exposed in URL bar.
RESULT: We successfully invoked servlet Pages from HTML.

You might also like