Professional Documents
Culture Documents
Web Technology
Web Technology
Conetens
1. Web
2. Working of web
3. Web Technology
4. Website
What is Web
• Web, is a way of accessing information over the medium of
the Internet.
Google Server
• The Web uses the HTTP( Hypertext Transfer Protocol )
protocol, only one of the languages spoken over the
Internet, to transmit data.
• वेब HTTP ( हाइपरटेक्स ट्रांसफर प्रोटोकॉल) प्रोटोकॉल का उपयोग करता है, डेटा प्रसारित
करने के लिए HTTP इंटरनेट पर बोली जाने वाली एक भाषा।
• The Web also utilizes browsers, such as Internet Explorer
or Firefox, to access Web documents called Web pages
that are linked to each other via hyperlinks.
• वेब उन वेब पेजों को एक्सेस करने के लिए इंटरनेट एक्सप्लोरर या फ़ायरफ़ॉक्स जैसे ब्राउज़रों का
उपयोग करता है, जिन्हें वेब पेज कहा जाता है जो हाइपरलिंक के माध्यम से एक दूसरे से जुड़े होते
हैं।
● Web documents also contain graphics, sounds, text and
video.
Welcome to
My Website
How it works
• वेब पेज को लाने और प्रदर्शित करने के लिए,वेब ब्राउज़र तब पर्दे के पीछे कम्युनिके शन
मैसेज की एक श्रृंखला शुरू करता है।
How it works
वेब प्रौद्योगिकियां वेब सर्वर और उनके ग्राहकों के बीच इंटरफे स प्रदान करती हैं
• Web page :-A web page is a document that is suitable for the
World Wide Web and can be accessed through a web browser
and displayed on a monitor or mobile device. This information is
usually in HTML or XHTML format, and may provide navigation to
other web pages via hypertext links. Web pages frequently
subsume other resources such as style sheets, scripts and images
into their final presentation.
• वेब पेज: -एक वेब पेज एक दस्तावेज़ है जो वर्ल्ड वाइड वेब के लिए उपयुक्त है और इसे वेब ब्राउज़र के माध्यम से
एक्सेस किया जा सकता है और मॉनिटर या मोबाइल डिवाइस पर प्रदर्शित किया जा सकता है। यह जानकारी
आमतौर पर HTML या XHTML प्रारूप में होती है, और हाइपरटेक्स्ट लिंक के माध्यम से अन्य वेब पृष्ठों पर
नेविगेशन प्रदान कर सकती है। वेब पेज अक्सर अपनी अंतिम प्रस्तुति में स्टाइल शीट, स्क्रिप्ट और छवियों जैसे अन्य
संसाधनों को ग्रहण करते हैं।
• Web pages may be retrieved from a local server or from a remote
web server. The web server may restrict access only to a private
network, e.g. a corporate intranet, or it may publish pages on the
World Wide Web. Web pages are requested from the clinet and
served from web servers using Hypertext Transfer Protocol
(HTTP).
• वेब पृष्ठों को स्थानीय सर्वर से या दूरस्थ वेब सर्वर से पुनर्प्राप्त किया जा सकता है। वेब सर्वर के वल
एक निजी नेटवर्क तक पहुंच को प्रतिबंधित कर सकता है, उदा। एक कॉर्पोरेट इंट्रानेट, या यह
वर्ल्ड वाइड वेब पर पेज प्रकाशित कर सकता है। हाइपरटेक्स्ट ट्रांसफर प्रोटोकॉल (एचटीटीपी) का
उपयोग कर वेब पेजों को क्लीनिक से मंगाया जाता है और वेब सर्वरों से परोसा जाता है।
• Every Web page is identified by a unique URL (Uniform Resource
Locator).
• प्रत्येक वेब पेज की पहचान एक अद्वितीय URL (यूनिफ़ॉर्म रिसोर्स लोके टर) द्वारा की जाती है।
Website
Web server
There is an easiest language to make a website file is HTML (Hyper
Text Mark up Language). Even you know nothing about this HTML
languange programming, you still can make a simple website file by
using a regular word processor software just like Microsoft Office
Word, Microsoft Office Excell, Microsoft frontpage or Openoffice for
Linux.
HTML (हाइपर टेक्स्ट मार्क अप लैंग्वेज) वेबसाइट फ़ाइल बनाने के लिए एक आसान भाषा है। यहां
तक कि
आप इस HTML प्रोग्रामिंग के बारे में कु छ भी नहीं जानते हैं, आप अभी भी Microsoft
Office Word, Microsoft Office Excell, Microsoft frontpage या
Linux के लिए Openoffice की तरह एक नियमित वर्ड प्रोसेसर सॉफ्टवेयर का उपयोग करके
एक साधारण वेबसाइट फ़ाइल बना सकते हैं।
The only thing you have to do is saving your file as HTML document
with .html extension by clicking "save as" tab and chose .html file
option
के वल एक चीज जो आपको करनी है, वह है अपनी फ़ाइल को HTML डॉक्यूमेंट के रूप में .html
एक्सटेंशन के साथ "save as" टैब और ".html फ़ाइल" विकल्प पर क्लिक करके ।
Save As myweb.html
• you must name your file with index.html if you want to make that
file become the first page (home page) of your website.
यदि आप उस फ़ाइल को अपनी वेबसाइट का पहला पृष्ठ (होम पेज) बनाना चाहते हैं, तो आपको
अपनी फ़ाइल को index.html के साथ नाम देना चाहिए।
• Website Address (URL = Uniform Resource Locator):
वेबसाइट का पता (URL = यूनिफ़ॉर्म रिसोर्स लोके टर):
• There are different parts of URL.URL के विभिन्न भाग हैं।
• The first part is called Protocol, we know it as http:// stands for
Hyper Text Transfer Protocol.HTTP protocaol is used to transmit
the data between server and client devices.
• पहले भाग को प्रोटोकॉल कहा जाता है, हम इसे http: // के रूप में जानते हैं जिसका उद्देश्य
हाइपर टेक्स्ट ट्रांसफर प्रोटोकॉल है।HTTP प्रोटोकॉल का उपयोग सर्वर और क्लाइंट डिवाइस के
बीच डेटा संचारित करने के लिए किया जाता है।
• The Second is www stands for World Wide Web. This means that
the page you're looking for is somewhere on the World Wide
Web.
• दूसरा www वर्ल्ड वाइड वेब के लिए है। इसका मतलब है कि आप जिस पेज को देख रहे हैं वह
वर्ल्ड वाइड वेब पर कहीं है।
• The third is the domain. This tells you where the web page is
registered, and often tells you what kind of web site it is.
• For instance, .com usually means that you're looking at a
commercial site, .edu sites for educational institutions, .org (sites
belonging to organizations), and .gov sites sponsored by local,
state governments.
• तीसरा डोमेन है। यह आपको बताता है कि वेब पेज कहां पंजीकृ त है, और अक्सर आपको बताता है
कि यह किस तरह की वेब साइट है।
• उदाहरण के लिए, .com का आमतौर पर मतलब है कि आप एक व्यावसायिक साइट, शैक्षिक
संस्थानों के लिए .edu साइट्स, .org (संगठनों से संबंधित साइट) और स्थानीय, राज्य
सरकारों द्वारा प्रायोजित .gov साइट्स देख रहे हैं।
Website Publishing Process
Planning
Organizing /Designing
v
v v v
v
Implementing
Testing
Published
Maintenance
1. Gathering Information
• First of all , we gather the following information about the
website.
• Purpose:- purpose of the site like provide information, promote a
service or sell a product.
• Target Audience
• Find out the audience there a specific group of people that will
help you reach your goals? It is helpful to picture the “ideal”
person you want to visit your web site. Consider their age, gender
or interests – this will help us determine the best design style for
your site.
Content
• The Content on the website may be a specific information, online
service, online ordering of particular product .
2. Planning
• Using the information gathered from phase one, it is time to put
together a plan for your web site. This is the point where a site
map is developed.
• The site map is a list of all main topic areas of the site, as well as
sub-topics, if applicable. This serves as a guide as to what content
will be on the site, and is essential to developing a consistent,
easy to understand navigational system.
• During the planning phase, web designer will also help you decide
what technologies should be implemented. Elements such as
interactive forms, ecommerce, flash, etc. are discussed when
planning your web site.
3. Organizing / Design
• During the design phase, your website takes shape. All the
visual content, such as images, photos, and videos is
created at this step.
• The website layout is the result of a designer’s work
Website Upload
GWPCI
• Maintenance:- Website Maintenance is the modification of a
website product after hosting to improve performance or
updating information.
Unit –II
• HTML is a language for describing the web pages.
items.
Heading Paragraph
Example
Head Section
Not visible in the browser
Title Bar
Body Section
Visible in the browser
<html>
<head>
<title>Polytechnic College </title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph</p>
</body>
</html>
Example Explained
The text between <html> and </html>
describes the web page
The text between <body> and </body> is the
visible page content
The text between <h1> and </h1> is displayed
as a heading
The text between <p> and </p> is displayed as
a paragraph
• HTM or HTML Extension?
• When you save an HTML file, you can use either the .htm or
the .html extension.
• HTML Links
• HTML links are defined with the <a> tag.
<a href="http://www.w3schools.com">This is a link</a>
• Note: The <a> tag contains an attribute (href) to provide the
link address.
Head section –
The <head> element is a container for metadata (data
about data) and is placed between the <html> tag and the
<body> tag. Metadata is data about the HTMLdocument.
Metadata is not displayed. Metadata typically define the
document title, character set, styles, scripts, and other
meta information.
<html>
<head>
Document Title,Prologue, Link, Base,character
--------- set,styles,scripts
</head>
<body>
• Head section –
• The head of the web page consist of the following section
Prologue, Link, Base, Meta, Script, Style
• Prologue (प्रस्तावना) :- The prologue appears at the beginning of every
HTML page, allowing browsers and other special software to
distinguish HTML documents from other types (DTDs) of SGML
(Standard Generalized Markup Language)
• HTML, XHTML, and XML are all examples of SGML-based languages.
• All HTML documents written according to the current HTML
specification (Version 4.01) should use the prologue tag displayed
below.
The prologue tag displayed below.
1 2 3 4 5 6 7
• <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<head>
<link ….. ….. >
</head>
Style sheet
</body>
</html>
The HTML <base> Element
• The HTML <base> tag is used to specify a base URL, for relative
links.
For example, you can set the base URL once at the top of your
page in header section, then all subsequent relative links
will use that URL as a starting point.
<html>
<head>
<title>HTML base Tag</title>
<base href = "https://www.tutorialspoint.com" />
</head>
<body>
HTML: <img src = "/images/html.gif" />
</body>
</html>
The HTML <base> Element
<html>
<head>
<title>My Link Demo</title>
<base
href="/media/adtmintadmin/4A7EB3637EB3470B/backup/Teaching
Odd Sem"/>
<base target="_self"/>
</head>
<body>
<a href="cssem5.pdf"> Cilck to open PDF</a>
</body>
</html>
The HTML <base> Element
target _self _self − the target URL will open in the same
frame as it was clicked.
_top _top − the target URL will open in the full body
of the window
Metadata
• Metadata is information about data.
• The <meta> tag provides metadata about the HTML document.
Metadata will not be displayed on the page, but will be machine
readable.
• Meta elements are typically used to specify page description,
keywords, author of the document, last modified, and other
metadata.
• The <meta> tag always goes inside the head element.
• The metadata can be used by browsers (how to display content or
reload page), search engines (keywords), or other web services.
Attribute Value Description
author
description
keywords
viewport
Attribute Value Description
refresh
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"> (8-bit Unicode Transformation Format)
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="ABC">
<meta name="viewport" content="width=device-width, initial-
scale=1.0"> The initial-scale=1.0 part sets the initial
zoom level when the page is first loaded by the
browser.
<meta http-equiv="refresh" content="30">
</head>
<body>
</body>
</html>
• The HTML <script> Element
• The <script> tag is used to define a client-side script, such as a
JavaScript.
• The script element either contains scripting statements or it
points to an external script file through the src attribute.
• You can place any number of scripts in an HTML
document. Scripts can be placed in the <body> , or in the
<head> section of an HTML page, or in both.
• The required type attribute specifies the MIME (Multi-purpose
Internet Mail Extensions) type of the script.
• Common uses for JavaScript are image manipulation, form
validation, and dynamic changes of content.
<body>
<head>
<script type="text/javascript">
<script type="text/javascript">
document.write("Hello
___________
World!")
_______
< /script>
< /script>
</head> </body>
JS External
• The HTML <style> Element
• The <style> tag is used to define style information for an HTML
document.
• Inside the style element you specify how HTML elements should
render in a browser:
< head>
< style type="text/css">
body {background-color:yellow}
p {color:blue}
< /style>
< /head>
• Body Section
• The body of the document contains all element that can be seen
when the user loads the page.
• It will include Header, Paragraphs, Text Formatting, Linking,
Internal Linking, Embedding Images, Lists, Tables, Frames. Other
Special Tags and Characters
Header
• Headings are defined with the <h1> to <h6> tags.
• <h1> defines the most important heading. <h6> defines the least
important heading.
• H1 headings should be used as main headings, followed by H2
headings, then the less important H3 headings, and so on.
• Example
• <h1>This is a heading 1</h1> == Most important heading
• < h2>This is a heading 2</h2>
• < h3>This is a heading 3</h3>
<h4>This is a heading 4</h4>
< h5>This is a heading 5</h5>
< h6>This is a heading 6</h6> == Least important heading
This is a heading 1
This is a heading 2
This is a heading 3
This is a heading 4
This is a heading 5
This is a heading 6
HTML Paragraph
• HTML documents are divided into paragraphs.
• The <p> tag defines a paragraph.
• The <p> tag supports the following standard attributes:
Attribute Description
class Specifies the class name for <p> tag.
id Specify a unique id for an element
style specify an inline CSS style for an element
title Specify extra information about an element
• HTML Paragraphs
• Example
• Underline - <u> </u>:- The text in between the tags will be display
as a underline text.
-------------
Chapter 1
In this chapter,we study the webpage
-------
Chapter 2
In this chapter,we study the website
-------
• To link to a specific spot on a web page, you need to use a pair of
anchors. One where you are linking from, and one where you
would like to link to. The first one, is where you are linking from.
It is very similar to the normal link tag.
• The starting tag looks like <a href="#name"> and the closing tag
looks like </A>. The text between the two tags is what is the link.
The text "name" identifies the anchor, giving it a name.
<a name=“Next“></a>
<HTML>
<BODY>
<A HREF=“#Next"> Go To The
Next Page </A>
-------------------------------------
-------------------------------------
-------------------------------------
-------------------------------------
<A NAME=“Next“></A>
</BODY>....
</HTML>
Embedding Images
• The <img> tag defines an image in an HTML page.
• The <img> tag has two required attributes: src and alt.
• In HTML the <img> tag has no end tag.
Attribute Value Description
src URL Specifies the URL of an image
alt text Specifies an alternate text for an
iamge,if the image for some
reason cannot be displayed
height pixel Specifies the height of an image
• The list items are marked with bullets (typically small black
circles).
• Example
Coffee
- black hot drink
Milk
- white cold drink
HTML Tables
• HTML tables allow web developers to arrange data
into rows and columns.
• Tables are defined with the <table> tag.
• A table is divided into rows (with the <tr> tag), and each row is
divided into data cells (with the <td> tag). td stands for "table
data," and holds the content of a data cell.
• A <td> tag can contain text, links, images, lists, forms, other
tables, etc.
<table>
Registration Details
12345
}
properties
Attributes
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr><td>abc</td>
<td>xyz</td>
<td>50</td></tr>
</table>
3. HTML Table - Add Cell Padding
Cell padding specifies the space between the cell
content and its borders.
table, th, td {
border: 1px solid black;
border-collapse: collapse;
padding: 15px;
}
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr><td>abc</td>
<td>xyz</td>
<td>50</td></tr>
</table>
4. HTML Table - align property
To align the table contents, use the CSS text-align property:
table, th, td {
border: 1px solid black;
border-collapse: collapse;
text-align: center;
}
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr><td>abc</td>
<td>xyz</td>
<td>50</td></tr>
</table>
5. HTML Table - Add Border Spacing
Border spacing specifies the space between the cells.
table, th, td {
border: 1px solid black;
text-align: center;
border-spacing: 5px;
}
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr><td>abc</td>
<td>xyz</td>
<td>50</td></tr>
</table>
6. HTML Table - Background-color
Background-color property specify the background color of
the table
table, th, td {
border: 1px solid black;
text-align: center;
border-collapse:collapse;
background-color: yellow;
}
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr><td>abc</td>
<td>xyz</td>
<td>50</td></tr>
</table>
7.HTML Table - Cell that Span Many Rows
To make a cell span more than one row, use the
rowspan attribute:
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
<table style="width:100%">
<tr>
<th>Name</th>
<th ="2">Telephone</th>
</tr>
<tr>
<td>Bill Gates</td>
<td>55577854</td>
<td>55577855</td>
</tr>
</table>
8.HTML Table - Cell that Span Many Columns
To make a cell span more than one column, use the
colspan attribute:
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
<table style="width:100%">
<tr>
<th>Name</th>
<th
colspan="2">Telephone</th>
</tr>
<tr>
<td>Bill Gates</td>
<td>55577854</td>
<td>55577855</td>
</tr>
</table>
Frames
• HTML frames are used to divide your browser window into
multiple sections where each section can load a separate
HTML document. A collection of frames in the browser
window is known as a frameset. The window is divided into
frames in a similar way the tables are organized: into rows
and columns.
Creating Frames
• To use frames on a page we use <frameset> tag instead of
<body> tag. The <frameset> tag defines, how to divide the
window into frames. The rows attribute of <frameset> tag
defines horizontal frames and cols attribute defines vertical
frames. Each frame is indicated by <frame> tag and it
defines which HTML document shall open into the frame.
The <frame> Tag Attributes
₹ ₹
INDIAN RUPEE SIGN
</p>
<p>The contents of website is ©
GWPC, Indore, Rajendra Nagar AB
Output
Road
</p> Salary of " John " is > 200 £
<p>registered trademark ®</p> The contents of website is ©
<p>₹ Indain Rupee</p> GWPC, Indore, Rajendra Nagar
AB Road
</body>
registered trademark ®
</html>
₹ Indain Rupee
• An HTML form is a section of a document containing normal
content, mark-up, special elements called controls
(checkboxes, radio buttons, menus, etc.), and labels on those
controls.
• Form elements are elements that allow the user to enter
information (like text fields, textarea fields, drop-down menus,
radio buttons, checkboxes, etc.) in a form.
• A form is defined with the <form> tag.
•
<form>
.
input elements
.
</form>
Input
• The most used form tag is the <input> tag. The type of input is
specified with the type attribute.
• The most commonly used input types are
Text Fields
• Text fields are used when you want the user to type letters,
numbers, etc. in a form.
<form>
First name:
<input type="text" name="firstname" />
</br >
Last name:
<input type="text" name="lastname" />
</form>
Password Field
• <input type="password" /> defines a password field:
< form>
Password:< input type="password" name="pwd" />
< /form>
Male
Female
Checkboxes
• <input type="checkbox" /> defines a checkbox. Checkboxes let a
user select ZERO or MORE options of a limited number of choices.
• < form>
• < input type="checkbox" name="vehicle" value="Bike" /> I have a
bike<br >
• < input type="checkbox" name="vehicle" value="Car" /> I have a
car
• < /form>
• How the HTML code above looks in a browser:
• I have a bike
I have a car
• Submit Button
• <input type="submit" /> defines a submit button.
• A submit button is used to send form data to a server. The data is
sent to the page specified in the form's action attribute. The file
defined in the action attribute usually does something with the
received input:
• < form name="input" action="html_form_action.asp"
method="get">
• Username:< input type="text" name="user" />
• < input type="submit" value="Submit" />
• < /form>
• the HTML code above looks in a browser:
• Username:
Submit
● The <select> Element
● The <select> element defines a drop-down list:
● The <option> elements defines an option that can be
selected one option from many options.
● By default, the first item in the drop-down list is selected.
● To define a pre-selected option, add the selected attribute
to the option:
● Example
● <select name="cars">
● <option value="volvo">Volvo</option>
● <option value="saab">Saab</option>
● <option value="fiat">Fiat</option>
● <option value="audi">Audi</option>
● </select>
● TextArea
● The <textarea> tag defines a multi-line text input control.
● A text area can hold an unlimited number of characters,
and text in a fixed-width font (usually Courier).
● The size of a text area can be specified by the cols and
rows attributes, or even better; through CSS' height and
width properties.
● <p> Address</p>
● <textarea name=”address” rows="4" cols="50">
● </textarea>
●
● Address:-
Unit -3
Java Script
• JavaScript is the scripting language of the Web.
• JavaScript is used in billions of Web pages to add functionality,
validate forms, communicate with the server.
Sum Age
• JavaScript is loosely based on Java and it is built into all the major
modern browsers.
• JavaScript is a scripting language produced by Netscape for use
within HTML Web pages.
• Arithmetic Expression
• Boolean Expressions
• Conditional Expression
Boolean Expressions
• Boolean expressions are used to make decisions.
• They always evaluate to one of two values: True or False.
• The following are some examples that use comparison operators:
• 2 < 3 The result is True because 2 is indeed less than 3.
• 4 > 5 The result is False because 4 is not greater than 5.
• 4 <= 4 The result is True because 4 is less than or equal to 4.
• x < 10 The result is True if x is any value less than 10; otherwise,
the result is False.
• y = x The result is True if y and x contain the same value;
otherwise, the result is False.
• The following are some examples of logical Expression:
• 2 < 3 And 4 > 5 Returns False because this expression evaluates to
True And False.
• 1 > 0 And 4 < 5 Returns True because this expression evaluates to
True And True.
• 2 < 3 Or 4 > 5 Returns True because this expression evaluates to
True Or False.
• x < 0 And y > 0 Returns True if x is negative and y is positive.
• x Or y Returns True if either variable contains a True value.
• The following example If...Then..Else statement written in
JavaScript. The condition is x < 3. If that condition is True, the
interpreter executes the first alert statement. If that condition is
False, the interpreter executes the second alert statement.
• if( x < 3 )
• alert( "x was less than 3" );
• else
• alert( "x was equal to 3 or greater" );
Keywords
• Keywords are the word which have predefined meaning.
• Keywords are words that is reserved for JavaScript for its own
use.
• keywords are not used as object, function names, variable names
or methods.
• The following keywords are available in JavaScript
1. break
• Breaks out of the current loop, switch, or labeled statement.
2. condition ? ifTrue : ifFalse
• Evaluates an expression, and does the first statement if the
expression is true, or the second statement if the expression is
false.
3. delete
• Deletes an object, a property of an object, or an element in an
array at the specified index.
4. do...while
• Acts as a loop that continues to execute the do This statement till
the while expression is true.
5. export
• Allows properties, functions, and objects from one script to be
accessed by other scripts.
6 for
• Executes a loop so that while expression A is true, executes
statement A and then evaluates expression B, then executes
statement B if expression B is true.
6. function
• Declares a function.
7. if...else
• If the expressionA is true, executes statementA. If the expression
is false, evaluates expressionB.
8. new
• Creates an instance of an object type that has a constructor
function.
9. return
• Specifies the value to be returned by a function.
10 switch
• Evaluates an expression, and executes the statement(s)
associated with the appropriate case for the value of the
expression.
11. void
• Evaluates the specified expression without returning a value.
12 while
• Executes a statement while the specified expression is true.
• Operator:- Java script allow the following operator
++ Increment by 1
- Subtracts 2 numbers.
-- Decrement by 1
* Multiplies 2 numbers.
/ Divides 2 numbers.
% Computes the integer remainder of
dividing 2 numbers.
• Operator:- Java script allow the following operator
Var A,B
if (A < B)
{
Document.write(A is less than B)
}
Else
{
Document.write(A is Greater than or Equal to B)
}
Iterative statements
• Iterative statements, also called loop statements, specify certain
commands to be executed repeatedly until some condition is met
do-while
In do while loop the body of the loop is always
executed at least once before the expression is evaluated.
Syntax:
do {
statement
} while (expression);
var i=0
do
{
document.write(i)
i++
} while (i<10);
Output:- 0 1 2 3 4 5 6 7 8 9
2. while
• The while statement is a pretest loop. This means the evaluation
of the escape condition is done before the code inside the loop
has been executed.
Syntax:
while(expression)
statement
Example
Var i=0
while( i<10)
{
document.write(i)
}
0 1 2 3 4 5 6 7 8 9
3. for
• The for statement is also a pretest loop
• Syntax:
• for (initialization; expression; post-loop-expression)
{
statement
}
Example
var iNum = 0;
for (var i=1; i < 10; i++)
{
document.write(i+"<br />")
}
Output 01 2 3 4 5 6 7 8 9
The break and continue statements
• The break and continue statements provide stricter control over
the execution of code in a loop.
• The break statement exits the loop immediately, preventing any
further repetition of the code while the continue statement exits
the current repetition. It does, however, allow further repetition
based on the control expression.
For example:
var iNum = 0;
for (var i=1; i < 10; i++)
{
if (i % 5 == 0) {
break;
}
alert(i);
var iNum = 0;
for (var i=1; i < 10; i++) {
if (i % 5 == 0) {
continue;
}
iNum++;
}
alert(iNum); //outputs “8”
Here, the alert displays “8”, the number of times the loop has
been executed. The total number of times that the loop can
possibly be executed is 9, but when i reaches a value of 5, the
continue statement is executed, causing the loop to skip the
expression iNum++ and return to the top
The switch statement
The switch statement, allows a developer to provide a series of
cases for an expression.
<h2>JavaScript switch</h2>
<p id="demo"></p>
<script>
var x = 0; Off
switch (x) {
case 0:
text = "Off";
break;
case 1:
text = "On";
break;
default:
text = "No value found";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
JavaScript Functions
• A function can be executed by an event, like clicking a button.
• A function is a block of code that executes only when you tell it to
execute.
• It can be executed when an event occurs, like when a user clicks a
button, or from a call within your script, or from a call within
another function.
• Functions can be placed both in the <head> and in the <body>
section of a document.
Syntax
function functionname()
{
some code
}
<html>
< head>
< script>
function myFunction()
{
alert("Hello World!");
}
</script>
</head>
< body>
< button onclick="myFunction()">Try it</button>
</body>
</html>
The above Code display the following result
Object of Java Scripts:-
• Everything" in JavaScript is an Object: a String, a Number, an
Array, a Date.
• An object is just a special kind of data, with properties and
methods.
Properties:
Methods:
name=Fiat
start()
model=500
drive()
weight=850kg
brake()
color=white
Objects in Real Life:
• If a car is an object:
• The properties of the car include name, model, weight, color,
etc.
• All cars have these properties, but the values of those
properties differ from car to car.
• The methods of the car could be start(), drive(), brake(), etc.
• All cars have these methods, but they are performed at
different times.
Java Script contain the following object
• Window Object
• Document Object
• Forms Objects
• Text Boxes
• Text Areas
• Buttons
• Radio Buttons
• Check Boxes,
• The Select Object
Window Object
1. The window object represents an entire browser window
• The window object represents an open window in a browser.
• If a document contain frames (<frame> or <iframe> tags), the
browser creates one window object for the HTML document,
and one additional window object for each frame.
S.N. Properties Description
Document Object
HTML
Document
If you want to access any element in an HTML page,
you always start with accessing the document object.
1
getElementByI The getElementById() method returns
d() the element that has the ID attribute
with the specified value.
2 The createElement() method creates an
createElement(
) Element Node with the specified name.
3 write() The write() method writes HTML
expressions or JavaScript code to a
document.
4 writeln() The writeln() method is identical to the
document.write() method, with the
addition of writing a newline character
after each statement.
5 Remove an HTML element
Form Object
• The Form object represents an HTML form.
• For each <form> tag in an HTML document, a Form object is
created.
• Forms are used to collect user input, and contain input
elements like text fields, checkboxes, radio-buttons, submit
buttons and more. A form can also contain select menus,
textarea, fieldset, and label elements.
• Forms are used to pass data to a server.
S.N. Properties Description
1
action Sets or returns the value of the action attribute in a
form
2
enctype Sets or returns the value of the enctype attribute in
a form
3
length Returns the number of elements in a form
First Name:
Create an Input Text Object
You can create an <input> element with type="text"
by using the document.createElement() method:
<script>
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
x.setAttribute("value", "Hello World!");
document.body.appendChild(x);
</script>
Text Object Properties
Method Description
Save
Button Object Properties
S.n Property Description
1 autofoc Sets or returns whether a
us button should automatically get
focus when the page loads, or
not
2 disabled Sets or returns whether a
button is disabled, or not
3 form Returns a reference to the form
that contains a button
4 name Sets or returns the value of the
name attribute of a button
5 type Sets or returns the type of a
button
6 value Sets or returns the value of the
Radio Object
• The Radio object represents a radio button in an HTML form.
• Radio buttons allow the user to select only ONE of a predefined
set of options.
• For each <input type="radio"> tag in an HTML form, a Radio
object is created.
Radio Object Properties
<script>
var d = new Date();
document.getElementById("demo").innerHTML = d;
</script>
Date Object Properties
Example
Math.random() ----- > 0.30969614797148415
<html>
<body>
<p id="demo"></p>
<script>
function myFunction() {
var x =3.4
document.getElementById("demo").innerHTML = Math.round(x);
}
</script>
</body>
</html> 3
String Object
• The String object is used to manipulate a stored piece of text.
• String objects are created with new String().
Property Description
Example
var str = "HELLO WORLD";
var res = str.charAt(0)
output
H
Method Description
strings
Example
var str1 = "Hello ";
var str2 = "world!";
var res = str1.concat(str2);
output
Hello world
Method Description
Example
var str = "Computer Science Engineering";
var n = str.endsWith("Engineering");
output
true
Method Description
Example
var res = String.fromCharCode(65);
output
A
Method Description
Example
var str = "18049C0401";
var n = str.includes("C04");
output
True
Method Description
Example
var str = "18049C0401";
var n = str.indexOf("C04");
output
5
Method Description
Example
var str = "18049C0401";
var n = str.match("\C04\g");
output
C04
Method Description
Example
var str = "Hello world!";
Output
Hello world!Hello world!
Method Description
Example
str= “Welcome Indore”
var res = str.replace("Indore", "Bhopal");
Output
Welcome Bhopal
Method Description
Example
str= “Welcome Indore”
var str = "Hello world!";
Output
Hello
Method Description
Example
str= “Welcome Indore”
var str = "Welcome Indore";
Output
Welcome,Indore
Method Description
Example
str= “Welcome Indore”
var str = "Hello world, welcome to the universe.";
var n = str.startsWith("Hello");
Output
true
Method Description
Example:-
var str = "Hello world!";
var res = str.substr(1, 4);
regular expression
• A regular expression is a sequence of characters that forms a
search pattern.
• The search pattern can be used for text search and text replace
operations.
• A regular expression can be a single character, or a more
complicated pattern.
Modifiers
• Modifiers are used to perform case-insensitive and global
searches:
rollno1=1002
rollno2=1004
rollno3=1005
rollno4=1008
Syntax:
var roll_no=[1002,1004,1005,1008];
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
roll_no[0]; Note: Array indexes start with 0.
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = roll_no;
</script>
Output
1002,1004,1005,1008
Array Object Properties
var a = fruits.indexOf("Apple");
Output
2
isArray()
Output
true
join()
Output
Banana,Orange,Apple,Mango
lastIndexOf()
<script>
function myFunction() {
var a = fruits.lastIndexOf("Apple");
var x = document.getElementById("demo");
x.innerHTML = a;
</script> output- 02
pop()
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits;
function myFunction() {
fruits.pop();
document.getElementById("demo").innerHTML = fruits;
}
</script>
push()
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits;
function myFunction() {
fruits.push("Kiwi");
document.getElementById("demo").innerHTML = fruits;
}
</script>
Property Value
• The selector is normally the HTML elements(tags) you want to
style.
• Each declaration consists of a property and a value.
• The property is the style attribute you want to change. Each
property has a value.
•
CSS Example
• A CSS declaration always ends with a semicolon, and
declaration groups are surrounded by curly brackets:
• Example
• p
• {<html>
<head>
• color:red;
<style>
• p
text-align:center;
{
} color:red;
text-align:center;
}
</style>
</head>
<body>
<p>Hello World!</p>
<p>This paragraph is styled with CSS.</p>
</body>
</html>
Output
Hello World!
This paragraph is styled with CSS.
Properties of Text
• Text is styled with some of the text formatting properties.
• There are different text properties are available in CSS
1. Text Color
• The color property is used to set the color of the text.
• With CSS, a color is most often specified by:
✔ a HEX value - like "#ff0000"
✔ an RGB value - like "rgb(255,0,0)"
✔ a color name - like "red"
Example
<html>
<head>
<style>
body {color:red;}
h1 {color:#00ff00;}
p.{color:rgb(0,0,255);}
</style>
</head>
<body>
<h1>This is heading 1</h1>
<p>This is an ordinary paragraph. </p>
</body>
</html>
2. Text Alignment
• The text-align property is used to set the horizontal alignment
of a text.
• Text can be centered, or aligned to the left or right, or justified.
• When text-align is set to "justify", each line is stretched so that
every line has equal width, and the left and right margins are
straight
Example
h1 {text-align:center;}
p.date {text-align:right;}
• p.main {text-align:justify;}
3. Text Decoration
• The text-decoration property is used to set or remove
decorations from text.
• The text-decoration property is mostly used to remove
underlines from links for design purposes:
• Example
• a {text-decoration:none;}
•
It can also be used to decorate text:
Example
h1 {text-decoration:overline;}
h2 {text-decoration:line-through;}
h3 {text-decoration:underline;}
4.Text Transformation
• The text-transform property is used to specify uppercase and
lowercase letters in a text.
• It can be used to turn everything into uppercase or lowercase
letters, or capitalize the first letter of each word.
Example
p.uppercase {text-transform:uppercase;}
p.lowercase {text-transform:lowercase;}
p.capitalize {text-transform:capitalize;}
Property Values of CSS
• In CSS there are different property value is available
Text property
S No Properties Values Examples
Color/Background Properties
1 background- (color), transparent Color is in
color hex code.
2 background- none, (location)
image
3 background- (percent), (length),
position top, center, bottom,
left, center, right
Property Values
Box Properties
S No Properties Values Examples
• </head>
• <body>
• <p><b>Welcome</b></p>
pseudo-classes
• CSS pseudo-classes are used to add special effects to some
selectors.
• Syntax
• The syntax of pseudo-classes:
• selector:pseudo-class {property:value;}
Example
a:link {color:green;} /* unvisited link */
a:visited {color:blue;} /* visited link */
a:hover {color:red;} /* mouse over link */
a:active {color:yellow;} /* selected link */
pseudo-elements
• CSS pseudo-elements are used to add special effects to some
selectors.
Syntax
• The syntax of pseudo-elements:
selector:pseudo-element {property:value;}
3. Relative Positioning
• A relative positioned element is positioned relative to its normal
position.
• The content of relatively positioned elements can be moved and
overlap other elements, but the reserved space for the element
is still preserved in the normal flow.
4. Absolute Positioning
• An absolute position element is positioned relative to the first
parent element
• Absolutely positioned elements can overlap other elements.
• In Absolute position element should be removed from the
normal flow of the document and will be placed in an exact
location on the page.
CSS Background
• CSS background properties are used to define the background
effects of an element.
CSS properties used for background effects:
• background-color
• background-image
• background-repeat
• background-attachment
• background-position
Background Color
• The background-color property specifies the background color
of an element.
• The background color of a page is defined in the body selector:
• Example
• body {background-color:#b0c4de;}
Background Image
• The background-image property specifies an image to use as the
background of an element.
• By default, the image is repeated so it covers the entire element.
• The background image for a page can be set like this:
• Example
• body {background-image:url('paper.gif');}
• background-repeat
• The background-repeat property specifies the
repeation of image.
• Repeat
• The image is repeated both horizontally and
vertically.
•
• repeat-x
The image is repeated horizontally only.
repeat-y
• The image is repeated vertically only.
•
• no-repeat
• If a background-image is specified, the background-
attachment CSS property determines whether that image's
position is fixed within the viewport, or scrolls along with its
containing block.
• background-attachment: scroll
• background-attachment: fixed
• The background-position property sets the starting position of
a background image
CSS Dimension
• The CSS dimension properties allow you to control the height
and width of an element.
• CSS Dimension Properties
document all
navigator body
plugins
location embeds
event filters
screen forms
images
Ke links
y
object plugins
collection scripts
styleSheets
•
•
•
• Blur
• Blurs the content of the object so that it appears out of focus.
• Chroma
• Displays a specific color of the content of the object as
transparent.
• Compositor
• Displays new content of the object as a logical color combination
of the new and original content.
• Glow
• Adds radiance around the outside edges of the content of the
object so that it appears to glow.
● Invert filter:-Invert filter effect is used to map the colors of
the object to their opposite values in the color spectrum.
● Grayscale:- Change the color of all images to black and
white :
● Brightness(%) :- Adjusts the brightness of the image.
● 0% will make the image completely black.
● 100% (1) is default and represents the original image.
● Values over 100% will provide brighter results.
● Contrast(%) :- Adjusts the contrast of the image.
● 0% will make the image completely black.
● 100% (1) is default and represents the original image.
● Values over 100% will provide results with less contrast.
• Matrix
• Resizes, rotates, or reverses the content of the
object using matrix transformation.
• Shadow
• Creates a Shadow the content of the object,
• Wave
• Performs a sine wave distortion of the content
of the object along the vertical axis.
• Transitions
• Fade
• content of the object is fading out the original
content.
• Blinds
• content of the object with a motion that
appears to open or close blinds.
• CheckerBoard
• content of the object is uncovering squares
placed like a checkerboard over the original
content.
• RadialWipe
• content of the object with a radial wipe, like a
windshield-wiper blade.
• RandomBars
• content of the object is exposing random lines
of pixels.
• Strips
• content of the object is moving successive
strips into place, like a diagonal saw blade
passing across the original content.
• Wheel
• content of the object with a rotating motion,
like spokes of a wheel covering the original
content.
Filtering a Tabular Data Control
Besides sorting it, a Tabular Data Control can
also be filtered, meaning the data can be
displayed selectively depending on the value of
the columns. For example, you may wish to
only show the first 5 students within a list of
student records, or only students with a grade
of 80% or higher. The ability to control how
much information gets displayed at once in a
TDC is very useful.
Unit-V
XML Basics
• XML stands for Extensible Mark-up Language
• XML is a mark-up language much like HTML
• XML was designed to carry data, not to display data
• XML tags are not predefined. You must define your own tags
• XML is designed to be self-descriptive
• XML data is stored in plain text format.
• This provides a software- and hardware-independent way of
storing data.
• With XML, data can easily be exchanged between
incompatible systems.
• XML Simplifies Platform Changes
• XML Makes Your Data More Available
• The syntax rules of XML are very simple and logical. The rules
are easy to learn, and easy to use.
• With XML, data can be stored in separate XML files.
• A lot of new Internet languages are created with XML.
• XML documents form a tree structure that starts at "the root"
and branches to "the leaves".
The Difference Between XML and HTML
HTML XML
1. HTML was designed to 1. XML was designed to
display data transport and store data
2. HTML is a markup 2. XML provides a framework
language itself for defining markup
languages.
3. HTML is a presentation 3. XML is neither a
language programming language
nor a presentation
4. HTML is not case sensitive
language.
4. XML is case sensitive .
5.
6.
The Difference Between XML and HTML
HTML XML
5. HTML is used for designing 5. XML is used basically to
a web-page on the client transport data between
side the application and the
database
6. HTML has it own predefined 6. XML flexible is that custom
tags tags can be defined and
the tags are invented by
the author of the XML
document.
7. XML makes it mandatory for
7. HTML is not strict if the user the user the close each tag
does not use the closing that has been used.
tags
The Difference Between XML and HTML
HTML XML
8. HTML does not preserve 8. XML preserves white space
white space . .
9. HTML is about displaying 9. XML is about carrying
data, hence static information, hence
dynamic.
Syntax of the XML Document
• The syntax rules of XML are very simple and logical. The rules
are easy to learn, and easy to use.
1. All XML Elements Must Have a Closing Tag
2. <p>This is a paragraph.</p>
2. XML Tags are Case Sensitive
• XML tags are case sensitive. The tag <Letter> is different from
the tag <letter>.
• Opening and closing tags must be written with the same case:
<Message>This is incorrect</message>
< message>This is correct</message>
3. XML Elements Must be Properly Nested
• In XML, all elements must be properly nested within each
other:
< root>
<child>
<subchild>.....</subchild>
</child>
< /root>
5. XML Attribute Values Must be Quoted
• In XML, the attribute values must always be quoted.
<note date="12/11/2007">
< to>John</to>
< from>jony</from
< /note>
6. Entity References
• Some characters have a special meaning in XML.
• If you place a character like "<" inside an XML element, it will
generate an error because the parser interprets it as the start
of a new element.
• This will generate an XML error: