Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Syllabus: Introduction to web technology, internet and www, Web site planning and design
issues, HTML: structure of html document , HTML elements: headings, paragraphs, line break,
colors & fonts, links, frames, lists, tables, images and forms, Difference between HTML and
HTML5. CSS: Introduction to Style Sheet, Inserting CSS in an HTML page, CSS selectors, XML:
Introduction to XML, XML key component, Transforming XML into XSLT, DTD: Schema,
elements, attributes, Introduction to JSON.
1.6 Budgeting
The budget has to cover (at the very least):
Planning - setting out requirements and perhaps a specification
Design
Implementation - including databases, associated support software, integration with
existing systems
Testing - both functional and cross-platform compatibility
Launch - deployment of component parts, website configuration
Operational costs - hosting, marketing, CRM, secure certificate
Website content management - in-house, out-of-house.
Frequently thought is only given to the design element, but some websites may require web
forms, databases, and perhaps integration with an existing sales order processing system. Some
calculation has to be done on the likely returns on investment for a commercial website to keep
the expenditure appropriate.
1.7 Commerce
There are specific issues with commerce that can cause problems. Apart from selling something
downloadable like software or reports (which are infinitely available) any other system has to
take account of stock either in-house or from a wholesaler. Even selling software presents its
own issues because a number of people making a simultaneous download of a 25Mb app may
have a serious impact on the performance of the server, not just for the visitors doing the
downloads, but also for any others visiting the website.
Some of the issues are:
Shopping systems - product management, price list management, baskets, special offers,
affiliate schemes
Payment handling - credit card, payment service provider, credit transfer and whether
manual or automatic
Credit card transactions - merchant ID, AVS (address verification system)
Secure certificates
Drop shipping - shipping directly from a wholesaler
Integration with your existing sales order processing system
Serial number management (software sales only)
VAT processing - place of supply, place of delivery considerations, EU issues
Terms and conditions, copyright, privacy policy and securing 'personal information'.
<!DOCTYPE...> This tag defines the document type and HTML version.
<html> This tag encloses the complete HTML document and mainly comprises of
document header which is represented by <head>...</head> and document body which is
represented by <body>...</body> tags.
<head> This tag represents the document's header which can keep other HTML tags like
<title>, <link> etc.
<title> The <title> tag is used inside the <head> tag to mention the document title.
<body> This tag represents the document's body which keeps other HTML tags like <h1>,
<div>, <p> etc.
This is heading 6
HTML links are hyperlinks. A hyperlink is a text or an image you can click on, and jump to
another document.
Example
<!DOCTYPE html>
<html>
<head>
<style>
a:link {
color: green; When Mouse Over The Link
background-color: transparent;
text-decoration: none;
}
a:visited {
color: pink;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}
a:active {
color: yellow;
background-color: transparent;
text-decoration: underline;
}
</style>
</head>
<body>
<p>You can change the default colors
of links</p>
<a href="html_images.asp"
target="_blank">HTML Images</a>
</body></html>
<!DOCTYPE html>
<html>
<body>
<p>If a browser cannot find an image,
it will display the alternate text:</
p>
<img src="wrongname.gif" alt="HTML5
Icon"
style="width:128px;height:128px;">
</body>
</html>
<table border="1"
style="width:100%">
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
2.7.2 Cell Padding
Cell padding specifies the space between the cell content and its borders. If you do not specify a
padding, the table cells will be displayed without padding. To set the padding, use the CSS
padding property:
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
}
</style>
</head>
<body>
<table style="width:100%">
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>
<p>Try to change the padding to
5px.</p>
</body>
</html>
2.7.3 Border Spacing
Border spacing specifies the space between the cells. To set the border spacing for a table, use
the CSS border-spacing property:
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border:1px solid
black;
padding:5px;
}
table {
border-spacing:
15px;
}
</style>
</head>
<body>
<table
style="width:100%">
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>
<p>Try to change the
border-spacing to 5px.</
p>
</body>
</html>
2.7.4 Table Cells that Span Many Columns
To make a cell span more than one column, use the colspan attribute:
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>
</head>
<body>
<h2>Cell that spans two columns:</h2>
<table style="width:100%">
<tr>
<th>Name</th>
<th colspan="2">Telephone</th>
</tr>
<tr>
<td>Bill Gates</td>
<td>555 77 854</td>
<td>555 77 855</td>
</tr>
</table>
</body>
</html>
2.8 HTML Lists
<!DOCTYPE html>
<html>
<body>
<h2>Unordered List </h2>
<ul style="list-style-type:disc">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
</html>
2.8.3 Ordered HTML Lists
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag. The list items will
be marked with numbers:
<!DOCTYPE html> Ordered List
<html> 1. Coffee
<body> 2. Tea
<h2>Ordered List</h2> 3. Milk
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h2>Ordered List with Numbers</h2>
<ol type="1">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
2.8.5 Description Lists
HTML also supports description lists. A description list is a list of terms, with a description of
each term. The <dl> tag defines the description list, the <dt> tag defines the term (name), and
the <dd> tag describes each term:
<!DOCTYPE html>
<html><body>
<h2>A Description List</h2>
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
</body></html>
<!DOCTYPE html>
<html>
<head>
<style>
ul#menu {
padding: 0;
}
ul#menu li {
display: inline;
}
ul#menu li a {
background-color: black;
color: white;
padding: 10px 20px;
text-decoration: none;
border-radius: 4px 4px 0 0;
}
ul#menu li a:hover {
background-color: orange;
}
</style>
</head>
<body>
<h2>Horizontal List</h2>
<ul id="menu">
<li><a
href="/html/default.asp">HTML</a></li>
<li><a href="/css/default.asp">CSS</a></
li>
<li><a
href="/js/default.asp">JavaScript</a></li>
<li><a href="/php/default.asp">PHP</a></
li>
</ul>
</body>
</html>
2.9 <div> Element
The <div> element is a block-level element that is often used as a container for other HTML
elements. The <div> element has no required attributes, but style and class are common. When
used together with CSS, the <div> element can be used to style blocks of content:
<!DOCTYPE html>
<html>
<body>
<div style="background-color:black; color:white; padding:20px;">
<h2>London</h2>
<p>London is the capital city of England. It is the most populous city
in the United Kingdom, with a metropolitan area of over 13 million
inhabitants.</p>
<p>Standing on the River Thames, London has been a major settlement
for two millennia, its history going back to its founding by the
Romans, who named it Londinium.</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<iframe src="demo_iframe.htm" width="200" height="200"></iframe>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<iframe width="100%" height="300px" src="demo_iframe.htm"
name="iframe_a"></iframe>
<p><a href="http://www.w3schools.com"
target="iframe_a">W3Schools.com</a></p>
<p>When the target of a link matches the name of an iframe, the link
will open in the iframe.</p>
</body>
</html>
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.
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.
<html>
<frameset cols="25%,*,25%">
<frame src="frame_a.htm">
<frame src="frame_b.htm">
<frame src="frame_c.htm">
</frameset>
</html>
<!DOCTYPE html>
<html>
<head>
<title>HTML Frames</title>
</head>
<frameset rows = "10%,80%,10%">
<frame name = "top" src = "/html/top_frame.htm" />
<frame name = "main" src = "/html/main_frame.htm" />
<frame name = "bottom" src = "/html/bottom_frame.htm" />
<noframes>
<body>Your browser does not support frames.</body>
</noframes>
</frameset>
</html>
2.12. The <form> Element
HTML forms are used to collect user input. The <form> element defines an HTML form:
<html>
<body>
<form>
First name:<br>
<input type="text" name="fname">
<br>
Last name:<br>
<input type="text" name="lname">
</form>
</body>
</html>
<html>
<body>
<form>
<input type="radio"
name="gender" value="male"
checked> Male<br>
<input type="radio"
name="gender" value="female">
Female<br>
<input type="radio"
name="gender" value="other"> Other
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<form action="action_page.php">
<select name="cars">
<option value="volvo">Volvo </
option>
<option value="saab">Saab
</option>
<option value="fiat">Fiat
</option>
<option value="audi">Audi
</option>
</select> <br><br>
<input type="submit">
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<form action="action_page.php">
<input type="checkbox" name="vehicle1" value="Bike">I
have a bike
<br>
<input type="checkbox" name="vehicle2" value="Car">I
have a car
<br><br>
<input type="submit">
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
#para1 {
text-align: center;
color: red;
}
</style>
</head>
<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not
affected by the style.</p>
</body>
</html>
<!DOCTYPE html>
<html><head>
<style>
.center {
text-align: center;
color: red;
}
</style>
</head>
<body>
<h1 class="center">Red and center-
aligned heading</h1>
<p class="center">Red and center-
aligned paragraph.</p>
</body></html>
You can also specify that only specific HTML elements should be affected by a class.
In the example below, only <p> elements with class="center" will be center-aligned:
<!DOCTYPE html>
<html>
<head>
<style>
p.center {
text-align: center;
color: red;
}
</style>
</head>
<body>
</body>
</html>
3.4 Types:
3.4.1 External Style Sheet:
With an external style sheet, you can change the look of an entire website by changing just one
file. An external style sheet can be written in any text editor. The file should not contain any html
tags. The style sheet file must be saved with a .css extension. Each page must include a reference
to the external style sheet file inside the <link> element. The <link> element goes inside the
<head> section:
mystyle.css
body {
background-color:
lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
<html>
<head>
<link rel="stylesheet" type="text/
css" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h2>RGB Color Examples</h2>
<h2 style="background-color:rgb(255, 0,
0)">
Background-color set by using rgb(255, 0,
0)
</h2>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h2>HEX Color Examples</h2>
<h2 style="background-color:#FF0000">
Background-color set by using #FF0000
</h2>
</body>
</html>
3.6 CSS Backgrounds
The CSS background properties are used to define the background effects for elements.
CSS background properties:
background-color
background-image
background-repeat
background-attachment
background-position
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: lightblue;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p>This page has a background
color!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image:
url("paper.gif");
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p>This page has an image as the
background!</p>
</body>
</html>
3.6.3 Background Image - Repeat Horizontally or Vertically
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-
image:url("gradient_bg.png");
background-repeat: repeat-x;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p>Here, a backgound image is repeated
only horizontally!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image:
url("img_tree.png");
background-repeat: no-repeat;
background-position: right top;
margin-right: 200px;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p>background no-repeat, set position
example.</p>
<p>Now the background image is only shown
once, and positioned away from the
text.</p>
<p>In this example we have also added a
margin on the right side, so the
background image will never disturb the
text.</p>
</body></html>
3.6.5 Background - Shorthand property
To shorten the code, it is also possible to specify all the background properties in one single
property. This is called a shorthand property.
<!DOCTYPE html>
<html><head>
<style>
body {
background: #ffffff
url("img_tree.png") no-repeat right top;
margin-right: 200px;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p>Now the background image is only shown
once, and it is also positioned away from
the text.</p>
</body></html>
4. XML
XML stands for Extensible Markup Language and is a text-based markup language derived from
Standard Generalized Markup Language (SGML).
XML is extensible − XML allows you to create your own self-descriptive tags, or
language, that suits your application.
XML carries the data, does not present it − XML allows you to store the data irrespective
of how it will be presented.
XML is a public standard − XML was developed by an organization called the World
Wide Web Consortium (W3C) and is available as an open standard.
1. XML Documents Must Have a Root Element: XML documents must contain
one root element that is the parent of all other elements
<root>
<child>
<subchild>.....</subchi
ld>
</child>
</root>
2. XML Declaration: The XML document can optionally have an XML declaration. It is
written as follows
<?xml version = "1.0" encoding = "UTF-8"?>
Syntax Rules for XML Declaration
The XML declaration is case sensitive and must begin with "<?xml>" where "xml" is
written in lower-case.
If document contains XML declaration, then it strictly needs to be the first statement
of the XML document.
The XML declaration strictly needs be the first statement in the XML document.
An HTTP protocol can override the value of encoding that you put in the XML
declaration.
3. All XML Elements Must Have a Closing Tag :In HTML, some elements might work
well, even with a missing closing tag, In XML, it is illegal to omit the closing tag. All
elements must have a closing tag.
4. 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
5. XML Elements Must be Properly Nested: In HTML, you might see improperly nested
elements:
<b><i>This text is bold and italic</
b></i>
XML Elements Must be Properly Nested.
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!
</body>
</note>
6. XML Attribute Values Must be Quoted :XML elements can have attributes in
name/value pairs just like in HTML. In XML, the attribute values must always be quoted.
<note date="12/11/2007">
<to>Tove</to>
<from>Jani</from>
</note>
7. 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.
<message>salary < 1000</
message>
There are 5 pre-defined entity references in XML:
< < less than
8. Comments in XML : The syntax for writing comments in XML is similar to that of
HTML.
<!-- This is a comment -->
<?xml
version = "version_number"
encoding = "encoding_declaration"
standalone = "standalone_status"
?>
Encoding UTF-8, UTF-16, ISO- It defines the character encoding used in the document.
10646-UCS-2, ISO- UTF-8 is the default encoding used.
10646-UCS-4, ISO-
8859-1 to ISO-8859-9,
ISO-2022-JP,
Shift_JIS, EUC-JP
Standalone yes or no It informs the parser whether the document relies on the
information from an external source, such as external
document type definition (DTD), for its content. The
default value is set to no. Setting it to yestells the
processor there are no external declarations required for
parsing the document.
4.4 XML - DTDs
The XML Document Type Declaration, commonly known as DTD, is a way to describe XML
language precisely. DTDs check vocabulary and validity of the structure of XML documents
against grammatical rules of appropriate XML language. An XML DTD can be either specified
inside the document, or it can be kept in a separate document and then liked separately.
<!DOCTYPE note
[
<!ELEMENT note
(to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
1. Elements
Elements are the main building blocks of both XML and HTML documents. Examples of
HTML elements are "body" and "table". Examples of XML elements could be "note" and
"message".
<message>some
text</message>
2. Attributes
Attributes provide extra information about elements. Attributes are always placed inside the
opening tag of an element. Attributes always come in name/value pairs. The following "img"
element has additional information about a source file:
<img src="computer.gif" />
3. Entities
Some characters have a special meaning in XML, like the less than sign (<) that defines the start
of an XML tag. Most of you know the HTML entity: " ". This "no-breaking-space" entity
is used in HTML to insert an extra space in a document. Entities are expanded when a document
is parsed by an XML parser.
< < less than
Elements are the building blocks of XML document. An element can be defined within an XSD
as follows −
<xs:element name = "x" type = "y"/>
4.4.3 Definition Types
You can define XML schema elements in the following ways −
Simple Type
Simple type element is used only in the context of the text. Some of the predefined simple types
are: xs:integer, xs:boolean, xs:string, xs:date. For example:
<xs:element name = "phone_number" type = "xs:int" />
Complex Type
A complex type is a container for other element definitions. This allows you to specify which
child elements an element can contain and to provide some structure within your XML
documents. For example:
<xs:element name = "Address">
<xs:complexType>
<xs:sequence>
<xs:element name = "name" type = "xs:string" />
<xs:element name = "company" type = "xs:string" />
<xs:element name = "phone" type = "xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
In the above example, Address element consists of child elements. This is a container for
other <xs:element>definitions, that allows to build a simple hierarchy of elements in the XML
document.
5. JSON
JSON or JavaScript Object Notation is a lightweight text-based open standard designed for
human-readable data interchange.
JSON stands for JavaScript Object Notation.
The format was specified by Douglas Crockford.
It was designed for human-readable data interchange.
It has been extended from the JavaScript scripting language.
The filename extension is .json.
JSON Internet Media type is application/json.
The Uniform Type Identifier is public.json.
{
"id":"01",
"language": "Java",
"edition": "third",
"author": "Herbert Schildt"
},
{
"id":"07",
"language": "C++",
"edition": "second",
"author": "E.Balagurusamy"
}
]
}
"Scala" : [
{ "Name" : "Scala for the Impatient", "price" : 1000
},
{ "Name" : "Scala in Depth", "price" : 1300 }]
}
var i = 0
document.writeln("<table border = '2'><tr>");
for(i = 0;i<books.Pascal.length;i++){
document.writeln("<td>");
document.writeln("<table border = '1' width = 100 >");
document.writeln("<tr><td><b>Name</b></td><td width = 50>"
+ books.Pascal[i].Name+"</td></tr>");
document.writeln("<tr><td><b>Price</b></td><td width =
50>" + books.Pascal[i].price +"</td></tr>");
document.writeln("</table>");
document.writeln("</td>");
}
for(i = 0;i<books.Scala.length;i++){
document.writeln("<td>");
document.writeln("<table border = '1' width = 100 >");
document.writeln("<tr><td><b>Name</b></td><td width = 50>"
+ books.Scala[i].Name+"</td></tr>");
document.writeln("<tr><td><b>Price</b></td><td width =
50>" + books.Scala[i].price+"</td></tr>");
document.writeln("</table>");
document.writeln("</td>");
}
document.writeln("</tr></table>");
</script>
</head>
<body>
</body>
</html>