WebDesign Book 2022
WebDesign Book 2022
design
BCS / BSE/DIT/DCS
BOOK NUMBER:
…………………………
NAME:
………………………………………………………………………..
1
INTRODUCTION
Web development is one of the fastest growing practices in the field of internet. It provides skills
necessary to efficiently package content for displaying on the web browser. Development of
professional websites requires skills on various technologies that are used such as HTML editors;
website management tools like FrontPage and/or Dream weaver; basic Internet technologies
such as DNS, email services, LDAP and the HTTP protocol. The practical part of this course
introduces tools and techniques for specifying and prototyping static websites. Skills required
for development of Interactive and advanced internet and web systems will be introduced later
in the programme through covering advanced programming and dynamic web applications
development.
INTERNET TECHNOLOGIES
Website Designing
Web designing has direct link to visual aspect of a web site. Effective web design is necessary to
communicate ideas effectively.
Internet
A global computer network providing a variety of information and communication facilities,
consisting of interconnected networks using standardized communication protocols.
Domain Name System Architecture
The Domain name system comprises of Domain Names, Domain Name Space, Name Server that
have been described below:
Domain Names
Domain Name is a symbolic string associated with an IP address. There are several domain
names available; some of them are generic such as com, edu, gov, net etc, while some country
level domain names such as au, in, za, us etc.
Domain Name (with an example ) Meaning (Indicate the owner of the domain)
Edu
Gov
Int
Mil
2
Net
Org
The following table below shows the Country top-level domain names:
Us United States
Za South Africa
Uk United Kingdom
Jp Turkey
De Tanzania
WWW is also known as W3. It offers a way to access documents spread over the several servers
over the internet. These documents may contain texts, graphics, audio, video, hyperlinks. The
hyperlinks allow the users to navigate between the documents.
HTTP is a communication protocol. It defines mechanism for communication between browser and
the web server. It is also called request and response protocol because the communication
between browser and server takes place in request and response pairs.
Here is the list of tools that can be used to make effective web designs:
Containing Block
3
Container can be in the form of page’s body tag, an all containing div tag. Without container there
would be no place to put the contents of a web page
Logo refers to the identity of a website and is used across a company’s various forms of marketing
such as business cards, letterhead, brouchers and so on.
Naviagation
The site’s navigation system should be easy to find and use. Oftenly the anvigation is placed rigth
at the top of the page.
Content
The content on a web site should be relevant to the purpose of the web site.
Footer
Footer is located at the bottom of the page. It usually contains copyright, contract and legal
information as well as few links to the main sections of the site.
Whitespace
It is also called as negative space and refers to any area of page that is not covered by type or
illustrations.
4
Web design Mistakes
One should be aware of the following common mistakes should always keep in mind:
Web development
Web development refers to building website and deploying on the web. Web development
requires use of scripting languages both at the server end as well as at client end.
Websites Hosting
Web hosting is a service of providing online space for storage of web pages. These web pages are
made available via World Wide Web. The companies which offer website hosting are known as
Web hosts.
The servers on which web site is hosted remain switched on 24 x7. These servers are run by web
hosting companies. Each server has its own IP address. Since IP addresses are difficult to
remember therefore, webmaster points their domain name to the IP address of the server their
website is stored on.
It is not possible to host your website on your local computer, to do so you would have to
leave your computer on 24 hours a day. This is not practical and cheaper as well. This is where
web hosting companies comes in.
5
Web Hosting Companies
Following are the several companies offering web hosting service. Identify any Five in Uganda and elsewhere.
Top five Ugandan Hosting Companies Top Five Hosting sites in the world
Web Browsers Web Browser is an application software that allows us to view and explore
information on the web. User can request for any web page by just entering a URL into address
bar.
Web browser can show text, audio, video, animation and more. It is the responsibility of a web
browser to interpret text and commands contained in the web page.
Search Engines
Search Engine refers to a huge database of internet resources such as web pages, newsgroups,
programs, images etc. It helps to locate information on World Wide Web.
6
Web development is one of the fastest growing practices in the field of internet. It provides skills
necessary to efficiently package content for displaying on the web browser. Development of
professional websites requires skills on various technologies that are used such as HTML editors;
website management tools like FrontPage and/or Dream weaver; basic Internet technologies such
as DNS, email services, LDAP and the HTTP protocol. The practical part of this course introduces
tools and techniques for specifying and prototyping static websites. Skills required for
development of Interactive and advanced internet and web systems will be introduced later in the
programme through covering advanced programming and dynamic web applications development.
These notes will introduce the learner to Basic HTML and CSS in a bid to design simple websites
Some concepts will however be handled in class and practically so. These notes should not be a
basis for you to dodge classes.
HTML stands for Hypertext Markup Language, and it is the most widely
used language to write Web Pages.
• Hypertext refers to the way in which Web pages (HTML documents) are
linked together. Thus, the link available on a webpage is called Hypertext.
HTML
Tags
As told earlier, HTML is a markup language and makes use of various tags
to format the content. These tags are enclosed within angle braces <Tag
Name>. Except few tags, most of the tags have their corresponding closing
tags. For example, <html> has its closing tag</html> and <body> tag has its
closing tag </body> tag etc.
Above example of HTML document uses the following tags:
Tag Description
<!DOCTYPE...> This tag defines the document type and HTML version.
8
<body> This tag represents the document's body which keeps
other HTML tags like <h1>, <div>, <p> etc.
To learn HTML, you will need to study various tags and understand how
they behave, while formatting a textual document. Learning HTML is simple
as users have to learn the usage of different tags in order to format the text
or images to make a beautiful webpage.
World Wide Web Consortium (W3C) recommends to use lowercase tags
starting from HTML
4.
<body>
Document body related tags
</body>
</html>
We will study all the header and body tags in subsequent chapters, but for
now let's see what is document declaration tag.
9
HTML Basics
Welcome to HTML Basics. This workshop leads you through the basics of Hyper Text Markup
Language (HTML). HTML is the building block for web pages. You will learn to use HTML to author
an HTML page to display in a web browser.
Objectives:
By the end of this workshop, you will be able to:
Prerequisites:
You will need a text editor, such as Notepad and an Internet browser, such as Internet Explorer or
Netscape.
Mac Users: SimpleText is the default text editor on the Mac. In OSX use TextEdit and
change the following preferences: Select (in the preferences window) Plain text instead of Rich
text and then select Ignore rich text commands in HTML files. This is very important because
if you don't do this HTML codes probably won't work.
One thing you should avoid using is a word processor (like Microsoft Word) for authoring your
HTML documents.
10
The markup tags tell the Web browser how to display the page An HTML file must have an
htm or html file extension
Try It?
Open your text editor and type the following text:
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
This is my first homepage. <b>This text is bold</b>
</body>
</html>
Save the file as mypage.html. Start your Internet browser. Select Open (or Open Page) in
the File menu of your browser. A dialog box will appear. Select Browse (or Choose File) and
locate the html file you just created - mypage.html - select it and click Open. Now you
should see an address in the dialog box, for example C:\MyDocuments\mypage.html.
Click OK, and the browser will display the page. To view how the page should look, visit this web
page: http://profdevtrain.austincc.edu/html/mypage.html
Example Explained
What you just made is a skeleton html document. This is the minimum required information for a
web document and all web documents should contain these basic components. The first tag in
your html document is <html>. This tag tells your browser that this is the start of an html
document. The last tag in your document is </html>. This tag tells your browser that this is the
end of the html document.
The text between the <head> tag and the </head> tag is header information. Header
information is not displayed in the browser window.
The text between the <title> tags is the title of your document. The <title> tag is used to
uniquely identify each document and is also displayed in the title bar of the browser window.
The text between the <body> tags is the text that will be displayed in your browser.
The text between the <b> and </b> tags will be displayed in a bold font.
11
HTM or HTML Extension?
When you save an HTML file, you can use either the .htm or the .html extension. The .htm
extension comes from the past when some of the commonly used software only allowed three
letter extensions. It is perfectly safe to use either .html or .htm, but be consistent.
mypage.htm and mypage.html are treated as different files by the browser.
Physical tags on the other hand provide specific instructions on how to display the text they
enclose. Examples of physical tags include:
HTML Elements
Remember the HTML example from the previous page:
12
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
This is my first homepage. <b>This text is bold</b>
</body>
</html>
The purpose of the <b> tag is to define an HTML element that should be displayed as bold.
<body>
This is my first homepage. <b>This text is bold</b>
</body>
This HTML element starts with the start tag <body>, and ends with the end tag </body>. The
purpose of the <body> tag is to define the HTML element that contains the body of the HTML
document.
Nested Tags
You may have noticed in the example above, the <body> tag also contains other tags, like the
<b> tab. When you enclose an element in with multiple tags, the last tag opened should be the
first tag closed. For example:
Tag Attributes
Tags can have attributes. Attributes can provide additional information about the HTML elements
on your page. The <tag> tells the browser to do something, while the attribute tells the browser
how to do it. For instance, if we add the bgcolor attribute, we can tell the browser that the
background color of your page should be blue, like this: <body bgcolor="blue">.
This tag defines an HTML table: <table>. With an added border attribute, you can tell the
browser that the table should have no borders: <table border="0">. Attributes always
come in name/value pairs like this: name="value". Attributes are always added to the start tag of
an HTML element and the value is surrounded by quotes.
Note: Some tags we will discuss are deprecated, meaning the World Wide Web Consortium
(W3C) the governing body that sets HTML, XML, CSS, and other technical standards decided those
tags and attributes are marked for deletion in future versions of HTML and XHTML. Browsers
should continue to support deprecated tags and attributes, but eventually these tags are likely to
become obsolete and so future support cannot be guaranteed.
Headings
Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading while <h6>
defines the smallest.
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
<h6> This is a heading</h6>
HTML automatically adds an extra blank line before and after a heading. A useful heading attribute
is align.
Paragraphs
Paragraphs are defined with the <p> tag. Think of a paragraph as a block of text. You can use the
align attribute with a paragraph tag as well.
Important: You must indicate paragraphs with <p> elements. A browser ignores any
indentations or blank lines in the source text. Without <p> elements, the document becomes one
large paragraph. HTML automatically adds an extra blank line before and after a paragraph.
15
Line Breaks
The <br> tag is used when you want to start a new line, but don't want to start a new paragraph.
The <br> tag forces a line break wherever you place it. It is similar to single spacing in a document.
Horizontal Rule
The <hr> element is used for horizontal rules that act as dividers between sections, like this:
The horizontal rule does not have a closing tag. It takes attributes such as align and width. For
instance:
Comments in HTML
The comment tag is used to insert a comment in the HTML source code. A comment can be placed
anywhere in the document and the browser will ignore everything inside the brackets. You can
use comments to write notes to yourself, or write a helpful message to someone looking at your
source code.
Notice you don't see the text between the tags <!-- and -->. If you look at the source code, you
would see the comment. To view the source code for this page, in your browser window, select
View and then select Source.
Note: You need an exclamation point after the opening bracket <!-- but not before the closing
bracket -->.
HTML automatically adds an extra blank line before and after some elements, like before and after
a paragraph, and before and after a heading. If you want to insert blank lines into your document,
use the <br> tag.
16
Try It Out!
Open your text editor and type the following text:
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<h1 align="center">My First Webpage</h1>
<p>Welcome to my first web page. I am writing this page using a
text editor and plain old html.</p>
<p>By learning html, I'll be able to create web pages like a
pro....<br> which I am of course.</p>
</body>
</html>
Save the page as mypage2.html. Open the file in your Internet browser. To view how the
page should look, visit this web page:
Tag Description
<abbr> Defines an abbreviation Tag Description
<acronym> Defines an acronym <b> Defines bold text
<address> Defines an address <big> Defines big text
element
<i> Defines italic text
<cite> Defines a citation
<small> Defines small text
<code> Defines computer code
<sup> Defines superscripted text
text
<sub> Defines subscripted text
<blockquote> Defines a long quotation
<tt> Defines teletype text
<del> Defines text
<u> Deprecated. Use styles
<dfn> Defines a definition term
instead
<em> Defines emphasized text
<ins> Defines inserted text
17
<kbd> Defines keyboard text
<pre> Defines preformatted text
<q> Defines a short quotation
<samp> Defines sample computer
Character tags like <strong> and <em> produce
code
the same physical display as <b> and <i> but are
<strong> Defines strong text more uniformly supported across different
<var> Defines a variable browsers.
Some Examples:
The following paragraph uses the <blockquote> tag. In the previous sentence, the blockquote
tag is enclosed in the <samp> Sample tag.
We the people of the United States, in order to form a more perfect Union, establish Justice, insure
domestic Tranquility, provide for the common defense, promote the general Welfare, and secure
the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution
for the United States of America.
Although most browsers render blockquoted text by indenting it, that's not specifically what it's
designed to do. It's conceivable that some future browser may render blockquoted text in some
other way. However, for the time being, it is perfectly safe to indent blocks of text with the
<blockquote>.
Non-breaking Space
The most common character entity in HTML is the non-breaking space Normally HTML
will truncate spaces in your text. If you add 10 spaces in your text, HTML will remove 9 of them.
To add spaces to your text, use the character entity.
HTML Fonts
The <font> tag in HTML is deprecated. The World Wide Web Consortium (W3C) has removed
the <font> tag from its recommendations. In future versions of HTML, style sheets (CSS) will be
used to define the layout and display properties of HTML elements.
HTML Backgrounds
Backgrounds
The <body> tag has two attributes where you can specify backgrounds. The background can be
a color or an image.
Bgcolor
The bgcolor attribute specifies a background-color for an HTML page. The value of this attribute
can be a hexadecimal number, an RGB value, or a color name:
19
<body bgcolor="#000000">
<body bgcolor="rgb(0,0,0)">
<body bgcolor="black">
Background
The background attribute can also specify a background-image for an HTML page. The value of
this attribute is the URL of the image you want to use. If the image is smaller than the browser
window, the image will repeat itself until it fills the entire browser window.
<body background="clouds.gif">
<body
background="http://profdevtrain.austincc.edu/html/graphics/clouds
.gif">
The URL can be relative (as in the first line above) or absolute (as in the second line above). If you
want to use a background image, you should keep in mind:
Will the background image increase the loading time too much?
Will the background image look good with other images on the page?
Will the background image look good with the text colors on the page?
Will the background image look good when it is repeated on the page?
Will the background image take away the focus from the text?
Note: The bgcolor, background, and the text attributes in the <body> tag are deprecated in the
latest versions of HTML (HTML 4 and XHTML). The World Wide Web Consortium (W3C)
has removed these attributes from its recommendations. Style sheets (CSS) should be used
instead (to define the layout and display properties of HTML elements).
Try It Out!
Open your text editor and type the following text:
<html>
<head>
<title>My First Webpage</title>
</head>
<body
background="http://profdevtrain.austincc.edu/html/graphics/clouds
.gif" bgcolor="#EDDD9E">
<h1 align="center">My First Webpage</h1>
20
<p>Welcome to my <strong>first</strong> webpage. I am writing this
page using a text editor and plain old html. </p>
<p>By learning html, I'll be able to create webpages like a
<del>beginner</del> pro....<br>
which I am of course. </p>
</body>
</htm>
Save your page as mypage3.html and view it in your browser.
Notice we gave our page a background color as well as a background image. If for some reason
the web page is unable to find the picture, it will display our background color.
HTML Colors
Color Values
Colors are defined using a hexadecimal notation for the combination of red, green, and blue color
values (RGB). The lowest value that can be given to one light source is 0 (hex #00). The highest
value is 255 (hex #FF). This table shows the result of combining red, green, and blue:
Color Names
A collection of color names is supported by most browsers.
Note: Only 16 color names are supported by the W3C HTML 4.0 standard (aqua, black, blue,
fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow). For all
other colors you should use the Color HEX value.
21
Color Color Color
HEX Name
#F0F8FF AliceBlue
#FAEBD7 AntiqueWhite
#7FFFD4 Aquamarine
#000000 Black
#0000FF Blue
#8A2BE2 BlueViolet
#A52A2A Brown
Web Safe Colors
A few years ago, when most computers supported only 256 different colors, a list of 216 Web Safe
Colors was suggested as a Web standard. The reason for this was that the Microsoft and Mac
operating system used 40 different "reserved" fixed system colors (about 20 each). This 216 cross
platform web safe color palette was originally created to ensure that all computers would display
all colors correctly when running a 256 color palette.
HTML Lists
HTML provides a simple way to show unordered lists (bullet lists) or ordered lists (numbered lists).
Unordered Lists
An unordered list is a list of items marked with bullets (typically small black circles). An unordered
list starts with the <ul> tag. Each list item starts with the <li> tag.
Ordered Lists
An ordered list is also a list of items. The list items are marked with numbers. An ordered list starts
with the <ol> tag. Each list item starts with the <li> tag.
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
22
Definition Lists
Definition lists consist of two parts: a term and a description. To mark up a definition list,
you need three HTML elements; a container <dl>, a definition term <dt>, and a definition
description <dd>.
Inside a definition-list definition (the <dd> tag) you can put paragraphs, line breaks, images, links,
other lists, etc
Try It Out
Open your text editor and type the following:
<html>
<head>
<title>My First Webpage</title>
</head>
<body bgcolor="#EDDD9E">
<h1 align="center">My First Webpage</h1>
<p>Welcome to my <strong>first</strong> webpage. I am writing this
page using a text editor and plain old html. </p>
<p>By learning html, I'll be able to create web pages like a
pro....<br> which I am of course. </p> Here's what I've learned:
<ul>
<li>How to use HTML tags</li>
<li>How to use HTML colors</li>
<li>How to create Lists</li>
</ul>
</body>
</html>
23
Save your page as mypage4.html and view it in your browser. Open it in a browser and see
how it looks like
24
HTML Links
HTML uses the <a> anchor tag to create a link to another document or web page.
The <a> tag is used to create an anchor to link from, the href attribute is used to tell the address
of the document or page we are linking to, and the words between the open and close of the
anchor tag will be displayed as a hyperlink.
Email Links
To create an email link, you will use mailto: plus, your email address. Here is a link to ACC's Help
Desk:
To add a subject for the email message, you would add? subject= after the email address. For
example:
<a href="mailto:[email protected]?subject=Email
Assistance">Email Help Desk</a>
To link directly to the top section, add a # sign and the name of the anchor to the end of a URL,
like this:
Note: Always add a trailing slash to subfolder references. If you link like this:
href="http://profdevtrain.austincc.edu/html", you will generate two HTTP requests to the server,
because the server will add a slash to the address and create a new request like this:
href="http://profdevtrain.austincc.edu/html/"
Named anchors are often used to create "table of contents" at the beginning of a large document.
Each chapter within the document is given a named anchor, and links to each of these anchors
are put at the top of the document. If a browser cannot find a named anchor that has been
specified, it goes to the top of the document. No error occurs.
HTML Images
The Image Tag and the Src Attribute
The <img> tag is empty, which means that it contains attributes only and it has no closing tag. To
display an image on a page, you need to use the src attribute. Src stands for "source". The value
of the src attribute is the URL of the image you want to display on your page. The syntax of defining
an image:
<img src="graphics/chef.gif">
26
Not only does the source attribute specify what image to use, but where the image is located. The
above image, graphics/chef.gif, means that the browser will look for the image name chef.gif
in a graphics folder in the same folder as the html document itself.
src="../../../other/images/chef.gif"
means this goes multiple layers up.
The browser puts the image where the image tag occurs in the document. If you put an image tag
between two paragraphs, the browser shows the first paragraph, then the image, and then the
second paragraph.
27
<img src="graphics/chef.gif" alt="Smiling Happy Chef ">
The alt attribute tells the reader what he or she is missing on a page if the browser can't load
images. The browser will then display the alternate text instead of the image. It is a good practice
to include the alt attribute for each image on a page, to improve the display and usefulness of
your document for people who have text-only browsers or use screen readers.
Image Dimensions
When you have an image, the browser usually figures out how big the image is all by itself. If you
put in the image dimensions in pixels however, the browser simply reserves a space for the image,
then loads the rest of the page. Once the entire page is loads it can go back and fill in the images.
Without dimensions, when it runs into an image, the browser has to pause loading the page, load
the image, then continue loading the page. The chef image would then be:
Open the file mypage2.html in your text editor and add code highlighted in bold:
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<h1 align="center">My First Web page</h1>
<p>Welcome to my first webpage. I am writing this page using a text editor and plain old html.
</p>
<p>By learning html, I'll be able to create web pages like a pro....<br> which I am of course. </p>
<!-- Who would have guessed how easy this would be :) -->
<p><img src="graphics/chef.gif" width="130" height="101"
alt="Smiling Happy Chef" align="center"></p>
<p align="center">This is my Chef</p>
</body>
</html>
Save your page as mypage5.html and view it in your browser. To see how your page should
look visit this web page:
28
29
Tables
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). The letters td stands for table data, which
is the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms,
horizontal rules, tables, etc.
Open up your text editor. Type in your <html>, <head> and <body> tags. From here on I will
only be writing what goes between the <body> tags. Type in the following:
<table border="1">
<tr>
30
<td>Tables can be used to layout information</td>
<td> <img
src="http://profdevtrain.austincc.edu/html/graphics/chef.gif">
</td>
</tr>
</table>
Save your page as mytable1.html and view it in your browser.
Headings in a Table
Headings in a table are defined with the <th> tag.
31
Cellspacing is the pixel width between the individual data cells in the table (The thickness of the
lines making the table grid). The default is zero. If the border is set at 0, the cellspacing lines will
be invisible.
Cellpadding is the pixel space between the cell contents and the cell border. The default for this
property is also zero. This feature is not used often, but sometimes comes in handy when you
have your borders turned on and you want the contents to be away from the border a bit for easy
viewing. Cellpadding is invisible, even with the border property turned on. Cellpadding can be
handled in a style sheet.
Table Tags
Tag Description
<table> Defines a table
<th> Defines a table header
<tr> Defines a table row
<td> Defines a table cell
<caption> Defines a table caption
<colgroup> Defines groups of table columns
<col> Defines the attribute values for one or more columns in a
table
32
Table Size
Table Width
The width attribute can be used to define the width of your table. It can be defined as a fixed
width or a relative width. A fixed table width is one where the width of the table is specified in
pixels. For example, this code, <table width="550">, will produce a table that is 550 pixels
wide. A relative table width is specified as a percentage of the width of the visitor's viewing
window. Hence this code, <table width="80%">, will produce a table that occupies 80
percent of the screen.
Try It Out!
An HTML <table> is used to divide a part of this Web page into two columns. The trick is to
use a table without borders, and maybe a little extra cell-padding. No matter how much
text you add to this page, it will stay inside its column borders.
33
Let's put everything you've learned together to create a simple page. Open your text editor and
type the following text:
<html>
<head>
<title>My First Web Page </title>
</head>
<body>
<table width="90%" cellpadding="5" cellspacing="0" >
<tr bgcolor="#EDDD9E">
<td width="200" valign="top"><img src="graphics/contact.gif"
width="100" height="100"></td>
<td valign="top"><h1 align="right">Janet Doeson</h1>
<h3 align="right">Technical Specialist</h3></td>
</tr>
<tr>
<td width="200">
<h3>Menu</h3>
<ul>
<li><a href="home.html">Home</a></li>
<li> <a href="faq.html">FAQ</a></li>
<li> <a href="contact.html">Contact</a></li>
<li> <a href="http://www.austincc.edu">Links</a> </li>
</ul></td>
<td valign="top"><h2 align="center">Welcome! </h2>
<p>Welcome to my first webpage. I created this webpage without
the assistance of a webpage editor. Just my little text editor and
a keen understanding of html. </p>
<p>Look around. Notice I'm able to use paragraphs, lists and
headings. You may not be able to tell, but the layout is done with
a table. I'm very clever. </p>
<blockquote>
<p>I always wanted to be somebody, but now I realize I should
have been more specific. </p>
<cite>Lily Tomlin </cite> </blockquote> </td>
</tr>
</table>
<hr width="90%" align="left">
<address>
Janet Doeson<br>
Technical Specialist<br>
512.555.5555
</address>
<p>Contact me at <a href="mailto:[email protected]">
[email protected] </a> </p>
</body>
Save your page as mytable2.html and view it in your browser.
34
What would be the output of the above code?
Page 35 of 88
ASSIGNMENT Create Your Own Page
It’s time to create your own page. Use your text editor to create a page which contains the
following:
Page 36 of 88
HTML Forms
What is HTML Form
HTML Forms are required to collect different kinds of user inputs, such as contact details like
name, email address, phone numbers, or details like credit card information, etc.
Forms contain special elements called controls like inputbox, checkboxes, radio-buttons, submit
buttons, etc. Users generally complete a form by modifying its controls e.g. entering text, selecting
items, etc. and submitting this form to a web server for processing.
The <form> tag is used to create an HTML form. Here's a simple example of a login form:
Example
<form>
<fieldset>
<legend>Log In</legend>
<label>Username: <input type="text"></label>
<label>Password: <input type="password"></label>
<input type="submit" value="Submit">
</fieldset>
</form>
The following section describes different types of controls that you can use in your form.
Input Element
It allows you to specify various types of user input fields, depending on the type attribute. An input
element can be of type text field, checkbox, password field, radio button, submit button, reset
button, etc. and several new input types introduced in HTML5.
Text Fields
Text fields are one line areas that allow the user to input text.
Single-line text input controls are created using an <input> element, whose type attribute has a
value of text. Here's an example of a single-line text input used to take username:
Example
<form>
<label for="username">Username:</label>
<input type="text" name="username" id="username">
</form>
Page 37 of 88
Password Field
Password fields are similar to text fields. The only difference is; characters in a password field are
masked i.e. shown as asterisks or dots. This is to prevent others from reading the password on the
screen. This is also a single-line text input controls created using an <input> element whose type
attribute has a value of password.
Example
Try this code »
<form>
<label for="user-pwd">Password:</label>
<input type="password" name="user-password" id="user-pwd">
</form>
Radio Buttons
Radio buttons are used to let the user select exactly one option from a pre-defined set of options.
It is created using an <input> element whose type attribute has a value of radio.
Example
Try this code »
<form>
<input type="radio" name="sex" id="male">
<label for="male">Male</label>
<input type="radio" name="sex" id="female">
<label for="female">Female</label>
</form>
Checkboxes
Checkboxes allows the user to select one or more option from a pre-defined set of options. It is
created using an <input> element whose type attribute has a value of checkbox.
Example
Try this code »
<form>
<input type="checkbox" name="sports" id="soccer">
<label for="soccer">Soccer</label>
<input type="checkbox" name="sports" id="cricket">
<label for="cricket">Cricket</label>
<input type="checkbox" name="sports" id="baseball">
<label for="baseball">Baseball</label>
</form>
Page 38 of 88
File Select box
The file fields allow a user to browse for a local file and send it as an attachment to the form data.
It normally rendered as a text box with a button that enables the user to browse for a file. However,
the user can also type the path and name of the file in the text box.
This is also created using an <input> element, whose type attribute value is set to file.
Example
Try this code »
<form>
<label for="file-select">Upload:</label>
<input type="file" name="upload" id="file-select">
</form>
Textarea
Textarea is a multiple-line text input control that allows a user to enter more than one line of text.
Multi-line text input controls are created using an <textarea> element.
Example
Try this code »
<form>
<label for="address">Address:</label>
<textarea rows="3" cols="30" name="address" id="address"></textarea>
</form>
Select Boxes
A select box is a dropdown list of options that allows user to select one or more option from a
pull-down list of options. Select box is created using the <select> element and <option>
element. The option elements within the <select> element define each list item.
Example
Try this code »
<form>
<label for="city">City:</label>
<select name="city" id="city">
<option value="sydney">Sydney</option>
<option value="melbourne">Melbourne</option>
<option value="cromwell">Cromwell</option>
</select>
</form>
Submit and Reset Buttons
A submit button is used to send the form data to a web server. When submit button is clicked the
form data is sent to the file specified in the form's action attribute to process the submitted data. A
reset button resets all the forms control to default values.
Page 39 of 88
Example
Try this code »
<form action="action.php" method="post" id="users">
<label for="first-name">First Name:</label>
<input type="text" name="first-name" id="first-name">
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
Most frequently used form attributes are:
Attribute Description
action URL of the program that processes the information submitted via form.
The HTTP method that the browser uses to submit the form. Possible values are get and
method
post.
A name or keyword indicating the target page where the result of the script will be displayed.
target
The reserved keywords are _blank, _self, _parent and _top.
Page 40 of 88
HTML Layout
Web page layout is an essential part of creating well-formed, well-structured, semantically-rich
websites.
Creating a website layout is the activity of positioning the various elements that make a web page
in a well-structured manner and give appealing look to the website.
You can find, most of the websites on the internet have put their content in multiple rows and
columns — formatted like a magazine or newspaper, to give general web users a better reading
and writing environment. This can be easily achieved by using the <table>, <div> or <span> tags
and adding some styles to them.
Tables are the simplest method for creating layouts in HTML. Generally, this involves the
process of putting the content into rows and columns.
The following HTML layout is achieved using a table with 3 rows and 2 columns — the first and
last row spans both columns using the colspan attribute:
Example
Try this code »
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Table Layout</title>
</head>
<body style="margin:0px;">
<table cellpadding="10px;" cellspacing="0" style="font:12px verdana, sans-
serif; width:100%;">
<tr>
<td colspan="2" style="background-color:#679BB7;">
<h1 style="font-size:18px; margin:10px 0;">Tutorial
Republic</h1>
</td>
HTML Layouts Using Div and Span
The HTML <div> (stands for division) element is used for marking out a block of content, or set
of other elements inside an HTML document. It can contain further div element if required, but it
cannot be contained within an inline element. The <span> element on the other hand is used for
marking out sections within a block element or other inline elements.
The following example uses the div elements to create a multiple column layout, producing the
same result as in the previous example that uses tables:
Page 41 of 88
Example
Try this code »
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Div Layout</title>
<style>
body{
font: 12px verdana, sans-serif;
margin: 0px;
}
.header{
padding: 10px 0;
background-color: #679BB7;
}
Creating Website Layouts Using HTML5 Structural Elements
HTML5 has introduced new structural elements like <header>, <footer>, <nav>, <section> etc.
to define different parts of the web pages in a more semantic way. You can consider these elements
as a replacement for commonly used classes such as .header, .footer, .nav, .section etc. The
following example uses the new HTML5 structural elements to create the same web page layout
what we have created in the previous examples.
Example
Try this code »
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML5 Web Page Layout</title>
<style type="text/css">
body{
font: 12px verdana, sans-serif;
margin: 0px;
}
header{
background-color: #679BB7;
padding: 10px;
}
The following table provides a brief overview of new structural elements in HTML5.
Tag Description
Page 42 of 88
<section> Defines a section of a document, such as header, footer etc.
Represents a widget from which the user can obtain additional information or controls
<details>
on-demand.
Page 43 of 88
1. CSS ─ OVERVIEW
What is CSS?
CSS handles the look and feel part of a web page. Using CSS, you can control
the color of the text, the style of fonts, the spacing between paragraphs, how
columns are sized and laid out, what background images or colors are used,
as well as a variety of other effects.
CSS is easy to learn and understand but it provides a powerful control over
the presentation of an HTML document. Most commonly, CSS is combined with
the markup languages HTML or XHTML.
Advantages of CSS
• CSS saves time - You can write CSS once and then reuse the
same sheet in multiple HTML pages. You can define a style for each
HTML element and apply it to as many web pages as you want.
• Pages load faster - If you are using CSS, you do not need to
write HTML tag attributes every time. Just write one CSS rule of a tag
and apply it to all the occurrences of that tag. So, less code means faster
download times.
• Easy maintenance - To make a global change, simply change
the style, and all the elements in all the web pages will be updated
automatically.
• Superior styles to HTML - CSS has a much wider array of
attributes than HTML, so you can give a far better look to your HTML
page in comparison to HTML attributes.
• Multiple Device Compatibility - Style sheets allow content to
be optimized for more than one type of device. By using the same HTML
document, different versions of a website can be presented for handheld
devices such as PDAs and cellphones or for printing.
• Global web standards – Now HTML attributes are being
deprecated and it is being recommended to use CSS. So it’s a good idea
Page 44 of 88
2. CSS ─SYNTAX
to start using CSS in all the HTML pages to make them compatible with
future browsers.
CSS comprises of style rules that are interpreted by the browser and then applied to
the corresponding elements in your document. A style rule is made of three parts:
• Selector: A selector is an HTML tag at which a style will be applied. This could
be any tag like <h1> or <table> etc.
• Property: A property is a type of attribute of HTML tag. Put simply, all the HTML
attributes are converted into CSS properties. They could be color, border, etc.
• Value: Values are assigned to properties. For example, color property can have
the value either red or #F1F1F1 etc.
You can put CSS Style Rule Syntax as follows:
selector { property: value }
Example: You can define a table border as follows:
table{ border :1px solid #C00; }
Here table is a selector and border is a property and the given value
1px solid #C00 is the value of that property.
You can define selectors in various simple ways based on your comfort.
Let me put these selectors one by one.
CSS Example
body {
background-color: lightblue;
}
h1 {
color: white;
text-align: center;
}
p {
font-family: verdana;
font-size: 20px;
}
Page 45 of 88
CSS Saves a Lot of Work!
The style definitions are normally saved in external .css files.
With an external stylesheet file, you can change the look of an entire website by
changing just one file!
Each declaration includes a CSS property name and a value, separated by a colon.
A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly
braces.
In the following example all <p> elements will be center-aligned, with a red text color:
p {
color: red;
text-align: center;
}
CSS Selectors
CSS selectors are used to "find" (or select) HTML elements based on their
element name, id, class, attribute, and more.
p {
text-align: center;
color: red;
}
The id Selector
The id selector uses the id attribute of an HTML element to select a specific
element.
To select an element with a specific id, write a hash (#) character, followed by
the id of the element.
The style rule below will be applied to the HTML element with id="para1":
#para1 {
text-align: center;
color: red;
}
To select elements with a specific class, write a period (.) character, followed by
the name of the class.
In the example below, all HTML elements with class="center" will be red and ce
.center {
text-align: center;
color: red;
}
You can also specify that only specific HTML elements should be affected by a
class.
Page 47 of 88
In the example below, only <p> elements with class="center" will be center-
aligned:
p.center {
text-align: center;
color: red;
}
Grouping Selectors
If you have elements with the same style definitions, like this:
h1 {
text-align: center;
color: red;
}
h2 {
text-align: center;
color: red;
}
p {
text-align: center;
color: red;
}
In the example below we have grouped the selectors from the code above:
Example
h1, h2, p {
text-align: center;
color: red;
}
Page 48 of 88
CSS Comments
Comments are used to explain the code, and may help when you edit the source
code at a later date.
A CSS comment starts with /* and ends with */. Comments can also span
multiple lines:
p {
color: red;
/* This is a single-line comment */
text-align: center;
}
/* This is
a multi-line
comment */
When a browser reads a style sheet, it will format the HTML document according to
the information in the style sheet.
Each page must include a reference to the external style sheet file inside the
<link> element. The <link> element goes inside the <head> section:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Page 49 of 88
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.
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
Note: Do not add a space between the property value and the unit (such
as margin-left: 20 px;). The correct way is: margin-left: 20px;
Internal styles are defined within the <style> element, inside the <head>
section of an HTML page:
<head>
<style>
body {
background-color: linen;
}
h1 {
color: maroon;
margin-left: 40px;
}
</style>
</head>
Inline Styles
An inline style may be used to apply a unique style for a single element.
To use inline styles, add the style attribute to the relevant element. The style
attribute can contain any CSS property.
The example below shows how to change the color and the left margin of a
<h1> element:
Page 50 of 88
<h1 style="color:blue;margin-left:30px;">This is a heading</h1>
Tip: An inline style loses many of the advantages of a style sheet (by mixing
content with presentation). Use this method sparingly.
Example
Assume that an external style sheet has the following style for the <h1>
element:
h1 {
color: navy;
}
then, assume that an internal style sheet also has the following style for the
<h1> element:
h1 {
color: orange;
}
If the internal style is defined after the link to the external style sheet, the
<h1> elements will be "orange":
Example
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<style>
h1 {
color: orange;
}
</style>
</head>
However, if the internal style is defined before the link to the external style
sheet, the <h1> elements will be "navy":
<head>
<style>
h1 {
color: orange;
Page 51 of 88
}
</style>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Cascading Order
What style will be used when there is more than one style specified for an HTML
element?
Generally speaking, we can say that all the styles will "cascade" into a new
"virtual" style sheet by the following rules, where number one has the highest
priority:
So, an inline style (inside a specific HTML element) has the highest priority,
which means that it will override a style defined inside the <head> tag, or in an
external style sheet, or a browser default value.
This is the same selector we have seen above. Again, one more example
to give a color to all level 1 headings:
h1 { color: #36CFFF;
}
The Universal Selectors
Rather than selecting elements of a specific type, the universal selector quite simply
matches the name of any element type:
* { color: #000000;
}
This rule renders the content of every element in our document in black.
Page 52 of 88
Suppose you want to apply a style rule to a particular element only when it lies inside
a particular element. As given in the following example, the style rule will apply to
<em> element only when it lies inside the <ul> tag.
ul em { color: #000000;
}
You can define style rules based on the class attribute of the elements. All the
elements having that class will be formatted according to the defined rule.
This rule renders the content in black for every element with class attribute set to
black in our document. You can make it a bit more particular. For example:
This rule renders the content in black for only <h1> elements with class attribute set
to black.
You can apply more than one class selectors to a given element. Consider the
following example:
The ID Selectors
You can define style rules based on the id attribute of the elements. All the elements
having that id will be formatted according to the defined rule.
This rule renders the content in black for every element with id attribute set to black
in our document. You can make it a bit more particular. For example:
This rule renders the content in black for only <h1> elements with id attribute set to
black.
The true power of id selectors is when they are used as the foundation for descendant
selectors. For example:
In this example, all level 2 headings will be displayed in black color when those
headings will lie within tags having id attribute set to black.
You have seen the descendant selectors. There is one more type of selector, which is
very similar to descendants but have different functionality. Consider the following
example:
You can also apply styles to HTML elements with particular attributes. The style rule
below will match all the input elements having a type attribute with a value of text:
The advantage to this method is that the <input type="submit" /> element is
unaffected, and the color applied only to the desired text fields.
There are following rules applied to attribute selector.
Page 54 of 88
• p[lang|="en"] - Selects all paragraph elements whose lang attribute contains
values that are exactly "en", or begin with "en-".
You may need to define multiple style rules for a single element. You can define these
rules to combine multiple properties and corresponding values into a single block as
defined in the following example:
Grouping Selectors
You can apply a style to many selectors if you like. Just separate the selectors with a
comma, as given in the following example:
This define style rule will be applicable to h1, h2 and h3 element as well. The order
of the list is irrelevant. All the elements in the selector will have the corresponding
declarations applied to them.
You can combine the various class selectors together as shown below:
There are four ways to associate styles with your HTML document. Most commonly
used methods are inline CSS and External CSS.
Page 55 of 88
Embedded CSS - The <style> Element
You can put your CSS rules into an HTML document using the <style> element. This
tag is placed inside the <head>...</head> tags. Rules defined using this syntax will
be applied to all the elements available in the document. Here is the generic syntax:
<head>
<style type="text/css" media="...">
Style Rules
............
</style>
</head>
Attributes
type text/css
Specifies the style sheet language as a content-
type (MIME type). This is a required attribute.
aural
all
Example
Page 56 of 88
<head>
<style type="text/css" media="all"> h1{ color: #36C; }
</style>
</head>
You can use style attribute of any HTML element to define style rules. These rules will
be applied to that element only. Here is the generic syntax:
Attributes
style
style The value of style attribute is a combination of style
rules declarations separated by semicolon (;).
Example
The <link> element can be used to include an external stylesheet file in your HTML
document.
An external style sheet is a separate text file with .css extension. You define all the
Style rules within this text file and then you can include this file in any HTML document
using <link> element.
Here is the generic syntax of including external CSS file:
Page 57 of 88
<head>
<link type="text/css" href="..." media="..." />
</head>
Attributes
type text/css
Specifies the style sheet language as a content-type
(MIME type). This attribute is required.
href URL Specifies the style sheet file having Style rules. This
attribute is a required.
aural
all
Example
Consider a simple style sheet file with a name mystyle.css having the following rules:
Now you can include this file mystyle.css in any HTML document as follows:
<head>
<link type="text/css" href="mystyle.css" media="all" />
</head>
Page 58 of 88
Imported CSS - @import Rule
<head>
<@import "URL";
</head>
Here URL is the URL of the style sheet file having style rules. You can use another
syntax as well:
<head>
<@import url("URL");
</head>
Example
Following is the example showing you how to import a style sheet file into an HTML
document:
<head>
@import "mystyle.css";
</head>
We have discussed four ways to include style sheet rules in an HTML document. Here
is the rule to override any Style Sheet Rule.
• Any inline style sheet takes the highest priority. So, it will override any rule
defined in <style>...</style> tags or the rules defined in any external style
sheet file.
• Any rule defined in <style>...</style> tags will override the rules defined in
any external style sheet file.
• Any rule defined in the external style sheet file takes the lowest priority, and
the rules defined in this file will be applied only when the above two rules are
not applicable.
Page 59 of 88
Handling Old Browsers
There are still many old browsers who do not support CSS. So, we should take care
while writing our Embedded CSS in an HTML document. The following snippet shows
how to use comment tags to hide CSS from older browsers:
<style type="text/css">
<!-- body, td { color: blue;
}
-->
</style>
CSS Comments
Many times, you may need to put additional comments in your style sheet blocks.
So, it is very easy to comment any part in the style sheet. You can simply put your
comments inside /*.....this is a comment in style sheet.....*/.
You can use /* ....*/ to comment multi-line blocks in similar way you do in C and
C++ programming languages.
Example
/* This is an external style sheet file */ h1, h2, h3 { color: #36C; font-
weight: normal; letter-spacing: .4em; margin-bottom: 1em; text-transform:
lowercase;
}
/* end of style rules. */
Page 60 of 88
4. CSS ─MEASUREMENT UNITS
Before we start the actual exercise, we would like to give a brief idea about the CSS
Measurement Units. CSS supports a number of measurements including absolute
units such as inches, centimeters, points, and so on, as well as relative measures
such as percentages and em units. You need these values while specifying various
measurements in your Style rules e.g. border="1px solid red".
We have listed out all the CSS Measurement Units along with proper Examples:
Unit Description Example
Defines a measurement as a
p {font-size: 16pt; line-height:
% percentage relative to another value,
125%;}
typically an enclosing element.
Page 61 of 88
5. CSS ─ COLORS
CSS uses color values to specify a color. Typically, these are used to set a color either for the
foreground of an element (i.e., its text) or for the background of the element. They can also
be used to affect the color of borders and other decorative effects.
You can specify your color values in various formats. Following table lists all the possible
formats:
Format Syntax Example
A hexadecimal is a 6 digit representation of a color. The first two digits (RR) represent a red
value, the next two are a green value (GG), and the last are the blue value (BB).
A hexadecimal value can be taken from any graphics software like Adobe Photoshop, Jasc
Paintshop Pro, or even using Advanced Paint Brush.
Page 62 of 88
Each hexadecimal code will be preceded by a pound or hash sign ‘#’. Following are the
examples to use Hexadecimal notation.
Color Color HEX
black #000000
Red #FF0000
Blue #0000FF
Yellow #FFFF00
#00FFFF
Pink #FF00FF
Grey #C0C0C0
white #FFFFFF
Page 63 of 88
Page 64 of 88
1.JAVASCRIPT OVERVIEW
What is JavaScript?
Client-Side JavaScript
Client-side JavaScript is the most common form of the language. The script should
be included in or referenced by an HTML document for the code to be interpreted by
the browser.
It means that a web page need not be a static HTML, but can include programs that
interact with the user, control the browser, and dynamically create HTML content.
The JavaScript client-side mechanism provides many advantages over traditional CGI
server-side scripts. For example, you might use JavaScript to check if the user has
entered a valid e-mail address in a form field.
The JavaScript code is executed when the user submits the form, and only if all the
entries are valid, they would be submitted to the Web Server.
JavaScript can be used to trap user-initiated events such as button clicks, link
navigation, and other actions that the user initiates explicitly or implicitly.
Page 65 of 88
Advantages of JavaScript
• Less server interaction: You can validate user input before sending the page
off to the server. This saves server traffic, which means less load on your
server.
• Immediate feedback to the visitors: They don't have to wait for a page
reload to see if they have forgotten to enter something.
• Increased interactivity: You can create interfaces that react when the user
hovers over them with a mouse or activates them via the keyboard.
• Richer interfaces: You can use JavaScript to include such items as drag-
anddrop components and sliders to give a Rich Interface to your site visitors.
Limitations of JavaScript
• Client-side JavaScript does not allow the reading or writing of files. This has
been kept for security reason.
Page 66 of 88
2.JAVASCRIPT– SYNTAX
The ECMAScript Edition 5 standard will be the first update to be released in over four
years. JavaScript 2.0 conforms to Edition 5 of the ECMAScript standard, and the
difference between the two is extremely minor.
The specification for JavaScript 2.0 can be found on the following site:
http://www.ecmascript.org/
Today, Netscape's JavaScript and Microsoft's JScript conform to the ECMAScript
standard, although both the languages still support the features that are not a part
of the standard.
JavaScript can be implemented using JavaScript statements that are placed within
the <script>... </script> HTML tags in a web page.
You can place the <script> tags, containing your JavaScript, anywhere within you
web page, but it is normally recommended that you should keep it within the <head>
tags.
The <script> tag alerts the browser program to start interpreting all the text between
these tags as a script. A simple syntax of your JavaScript will appear as follows.
<script ...>
JavaScript code
</script>
• Language: This attribute specifies what scripting language you are using.
Typically, its value will be javascript. Although recent versions of HTML (and
XHTML, its successor) have phased out the use of this attribute.
Page 67 of 88
• Type: This attribute is what is now recommended to indicate the scripting
language in use and its value should be set to "text/javascript".
So your JavaScript syntax will look as follows.
Let us take a sample example to print out "Hello World". We added an optional HTML
comment that surrounds our JavaScript code. This is to save our code from a browser
that does not support JavaScript. The comment ends with a "//-->". Here "//"
signifies a comment in JavaScript, so we add that to prevent a browser from reading
the end of the HTML comment as a piece of JavaScript code. Next, we call a function
document.write which writes a string into our HTML document.
This function can be used to write text, HTML, or both. Take a look at the following
code.
<html>
<body>
<script language="javascript" type="text/javascript">
<!--
document.write ("Hello World!")
//-->
</script>
</body> </html>
Hello World!
Page 68 of 88
JavaScript ignores spaces, tabs, and newlines that appear in JavaScript programs.
You can use spaces, tabs, and newlines freely in your program and you are free to
format and indent your programs in a neat and consistent way that makes the code
easy to read and understand.
But when formatted in a single line as follows, you must use semicolons:
Case Sensitivity
Page 69 of 88
Comments in JavaScript
• Any text between a // and the end of a line is treated as a comment and is
ignored by JavaScript.
• Any text between the characters /* and */ is treated as a comment. This may
span multiple lines.
• JavaScript also recognizes the HTML comment opening sequence <!--.
JavaScript treats this as a single-line comment, just as it does the // comment.
Example
The following example shows how to use comments in JavaScript.
/*
* This is a multiline comment in JavaScript
* It is very similar to comments in C Programming
*/
//-->
</script>
All the modern browsers come with built-in support for JavaScript. Frequently, you
may need to enable or disable this support manually. This chapter explains the
procedure of enabling and disabling JavaScript support in your browsers: Internet
Explorer, Firefox, chrome, and Opera.
Here are the steps to turn on or turn off JavaScript in Internet Explorer:
Page 70 of 88
3.JAVASCRIPT– ENABLING
JavaScript in Firefox
• Open a new tab -> type about: config in the address bar.
• Then you will find the warning dialog. Select I’ll be careful, I promise!
• Then you will find the list of configure options in the browser.
• In the search bar, type javascript.enabled.
• There you will find the option to enable or disable javascript by right-clicking
on the value of that option -> select toggle.
If javascript.enabled is true; it converts to false upon clicking toogle. If javascript
is disabled; it gets enabled upon clicking toggle.
Page 71 of 88
JavaScript in Chrome
• Click the Chrome menu at the top right hand corner of your browser.
• Select Settings.
• Click Show advanced settings at the end of the page.
• Under the Privacy section, click the Content settings button.
• In the "Javascript" section, select "Do not allow any site to run JavaScript" or
"Allow all sites to run JavaScript (recommended)".
JavaScript in Opera
If you have to do something important using JavaScript, then you can display a
warning message to the user using <noscript> tags.
You can add a noscript block immediately after the script block as follows:
<html>
<body>
Page 72 of 88
4.JAVASCRIPT– PLACEMENT
<!--
19
<noscript>
Sorry...JavaScript is needed to go ahead.
</noscript>
</body> </html>
Now, if the user's browser does not support JavaScript or JavaScript is not enabled,
then the message from </noscript> will be displayed on the screen
If you want to have a script run on some event, such as when a user clicks
somewhere, then you will place that script in the head as follows.
Page 73 of 88
<html>
<head>
<script type="text/javascript">
<!--
function sayHello() { alert("Hello World")
}
//-->
</script>
</head>
<body>
Click here for the result
<input type="button" onclick="sayHello()" value="Say Hello" />
</body>
</html>
If you need a script to run as the page loads so that the script generates content in
the page, then the script goes in the <body> portion of the document. In this case,
you would not have any function defined using JavaScript. Take a look at the
following code.
Page 74 of 88
<html> <head>
</head>
<body>
<script type="text/javascript">
<!--
document.write("Hello World")
//-->
</script>
<p>This is web page body </p>
</body>
</html>
Hello World
This is web page body
You can put your JavaScript code in <head> and <body> section altogether as
follows.
Page 75 of 88
<html>
<head>
<script type="text/javascript">
<!--
function sayHello() { alert("Hello World")
}
//-->
</script>
</head>
<body>
<script type="text/javascript">
<!--
document.write("Hello World")
//-->
</script>
<input type="button" onclick="sayHello()" value="Say Hello" />
</body>
</html>
HelloWorld
Say Hello
As you begin to work more extensively with JavaScript, you will be likely to find
that there are cases where you are reusing identical JavaScript code on multiple
pages of a site.
You are not restricted to be maintaining identical code in multiple HTML files. The
script tag provides a mechanism to allow you to store JavaScript in an external file
and then include it into your HTML files.
Page 76 of 88
5.JAVASCRIPT– VARIABLES
Here is an example to show how you can include an external JavaScript file in your
HTML code using script tag and its src attribute.
<html>
<head>
<script type="text/javascript" src="filename.js" ></script>
</head> <body>
....... </body> </html>
To use JavaScript from an external file source, you need to write all your JavaScript
source code in a simple text file with the extension ".js" and then include that file as
shown above.
For example, you can keep the following content in filename.js file and then you
can use sayHello function in your HTML file after including the filename.js file.
JavaScript Datatypes
Page 77 of 88
JavaScript represents numbers using the 64-bit floating-point format defined by the
IEEE 754 standard.
JavaScript Variables
Like many other programming languages, JavaScript has variables. Variables can
be thought of as named containers. You can place data into these containers and
then refer to the data simply by naming the container.
Before you use a variable in a JavaScript program, you must declare it. Variables
are declared with the var keyword as follows
<script type="text/javascript">
<!-- var money; var name;
25
//-->
</script>
You can also declare multiple variables with the same var keyword as follows:
<script type="text/javascript">
<!-- var money, name;
//-->
</script>
Page 78 of 88
<script type="text/javascript">
<!--
var name = "Ali"; var money; money = 2000.50;
//-->
</script>
Note: Use the var keyword only for declaration or initialization, once for the life of
any variable name in a document. You should not re-declare same variable twice.
JavaScript is untyped language. This means that a JavaScript variable can hold a
value of any data type. Unlike many other languages, you don't have to tell JavaScript
during variable declaration what type of value the variable will hold. The value type
of a variable can change during the execution of a program and JavaScript takes care
of it automatically.
While naming your variables in JavaScript, keep the following rules in mind.
• You should not use any of the JavaScript reserved keywords as a variable
name. These keywords are mentioned in the next section. For example, break
or boolean variable names are not valid.
• JavaScript variable names should not start with a numeral (0-9). They must
begin with a letter or an underscore character. For example, 123test is an
invalid variable name but _123test is a valid one.
• JavaScript variable names are case-sensitive. For example, Name and name
are two different variables.
A list of all the reserved words in JavaScript are given in the following table. They
cannot be used as JavaScript variables, functions, methods, loop labels, or any
object names.
Page 79 of 88
JavaScript is not Java, Developed by Netscape, not Sun.
Only executed in a browser. It is not a full-featured programming language.
However, the syntax is similar.
Uses of JavaScript
To add dynamic function to your HTML.
JavaScript does things that HTML can’t—like logic.
You can change HTML on the fly.
To shoulder some of the form-processing burden.
JavaScript runs in the browser, not on the Web server.
Better performance
JavaScript can validate the data that users enter into the form, before it is sent to
your Web application.
The Document Object Model makes it possible to support dynamic HTML documents
with JavaScript
Page 80 of 88
Page 81 of 88
WordPress
WordPress is an open source Content Management System (CMS), which allows the users to
build dynamic websites and blog. WordPress is the most popular blogging system on the web and
allows updating, customizing and managing the website from its back-end CMS and components.
This tutorial will teach you the basics of WordPress using which you can create websites with
ease. The tutorial is divided into various sections for convenience. Each of these sections contain
related topics with screenshots explaining the WordPress admin screens.
WordPress is an open source Content Management System (CMS), which allows the users to
build dynamic websites and blogs. WordPress is the most popular blogging system on the web
and allows updating, customizing and managing the website from its back-end CMS and
components.
The Content Management System (CMS) is a software which stores all the data such as text,
photos, music, documents, etc. and is made available on your website. It helps in editing,
publishing and modifying the content of the website.
WordPress was initially released on 27th May, 2003 by Matt Mullenweg and Mike Little.
WordPress was announced as open source in October 2009.
Features
• User Management − It allows managing the user information such as changing the
role of the users to (subscriber, contributor, author, editor or administrator), create or
delete the user, change the password and user information. The main role of the user
manager is Authentication.
• Media Management − It is the tool for managing the media files and folder, in
which you can easily upload, organize and manage the media files on your website.
• Theme System − It allows modifying the site view and functionality. It includes
images, stylesheet, template files and custom pages.
• Extend with Plugins − Several plugins are available which provides custom
functions and features according to the users need.
• Search Engine Optimization − It provides several search engine optimization (SEO)
tools which makes on-site SEO simple.
• Multilingual − It allows translating the entire content into the language preferred
by the user.
• Importers − It allows importing data in the form of posts. It imports custom files,
comments, post pages and tags.
Advantages
Page 82 of 88
• It is an open source platform and available for free.
• CSS files can be modified according to the design as per users need.
• There are many plugins and templates available for free. Users can customize the
various plugins as per their need.
• It is very easy to edit the content as it uses WYSIWYG editor (What You See Is What
You Get is a user interface that allows the user to directly manipulate the layout of
document without having a layout command).
• Media files can be uploaded easily and quickly.
• It offers several SEO tools which makes on-site SEO simple.
• Customization is easy according to the user's needs.
• It allows creating different roles for users for website such as admin, author, editor
and contributor.
Disadvantages
• Using several plugins can make the website heavy to load and run.
• PHP knowledge is required to make modifications or changes in the WordPress
website.
• Sometimes software needs to be updated to keep the WordPress up-to-date with
the current browsers and mobile devices. Updating WordPress version leads to loss of
data, so it a backup copy of the website is required.
• Modifying and formatting the graphic images and tables is difficult.
We’ll now illustrate how to install and design dynamic websites using WordPress.
Page 83 of 88
Website Development Document guide
Concept Document
• A document showing the objectives of systems development (website development);
• Handed in by project team to management
• Meant to seek authorization and funding
• It is a planning stage in Website development
• It is a blueprint that will guide us on how the website will work
Site Planning and Development
• Web Site Goals/ objectives
• Planning Stages
• Conceptualization of the website
• Content Development
• Web Site Design Principles
A: Web Site Goals
• What are the aims of building your site?
• What are the client needs?
• Are these in line with Company Mission?
• Does going online improve our competitive position?
B: Planning Stages
• Systems analysis and design (Planning)
• Building the system: In-house vs. outsourcing
• Website hosting: In-house vs. outsourcing
• System Testing, Implementation and maintenance
• Website optimization factors
Systems Analysis& Design
• Analyze the current systems
• How is the firm managing its clients?
• Is going online better than existing marketing platforms?
• How feasible is website development?
o Technically
o Socially
o Politically/ Organizational policy compliance?
o Financially/ Economically
o Select a design method; RAD, JAD, Prototyping, or SDLC?
Website hosting Considerations?
: In-house vs. outsourcing
• Cost (Server Per Month)
• Hardware requirements
• Network Traffic you are planning for
• Bandwidth limits
• Facilities provided
• Customer Care
• Server Platform (both for Web server and for databases)
• Disk space allocations
• User friendliness of Providers’ interface
Other Considerations?
Page 84 of 88
• Extra charges for exceeding disk space, bandwidth
• Limits on e-mail accounts and types of e-mail access (POP3, Web, etc)
• Tech support provided (and toll-free support number)
• Monthly rates and Setup fees
• Tools available to administer your site, such as adding new users, changing user permissions,
adding directories, modifying directory permissions
• Add-on software provided such as ColdFusion Server, WebTrends,
• Backup schedule, procedures, and guarantees
• Referrals from other clients
• Reputation of Service provider
In-house Hosting
Benefits Costs Incurred:
Secure systems Costs Incurred:
Competitive advantage • Company may lack expertise to host its
Cheaper than outsourcing own system
Efficient disk space allocation • Employees may compromise systems
No Bandwidth limits security
Day-to-day Maintenance is easy
Data Backup are easy
Out-Sourced Hosting
Benefits Costs Incurred:
More reliability since Host is professional • Company is locked into the hosting
A greater level of availability provider’s system, technologies and
The burden of servers and other network policies.
hardware do not fall on your shoulders • Insecurity of firm’s sensitive web-data
A chance to concentrate on more key • Costly in terms of charges
activities of the firm • No competitive advantage coz we use a
generic industry system
• Less administrative control over your
entire domain
Page 85 of 88
• Contact us
• Order
Make diagrammatical representations of your system
About Us Page
Page 86 of 88
Identify the Tools to Use
Page 87 of 88
• Adaptive maintenance: performed after delivery to keep a website good in a changed or
changing business environment.
Web-Optimization Factors
How do u make your domain a destination online?
Factors that will attract people to your site:
Use your keyword in your title tag, e.g the word MIU must appear in www.mui.ac.ug
Anchor text of inbound links
Link popularity of your site- how many external links do you get to your site?
The age of your website- Older sites are deemed to be more trust-worthy and if you are starting
anew site, it may pay to research older domains that are available for purchase
Internal link structure of your website- no dead links
Topical relevance of external links to your site- are all links you have relevant to a visitor
Use of important keywords in your body text
Text surrounding your inbound links should be related to what you do
Unique, relevant content will draw traffic
1. A website of not less than 5 pages and 1 CSS file. Zip it with images.
2. A concept document for your website. Submit hard copy.
3. A similar website developed with WordPress
Good Luck
Page 88 of 88