Web Development
Web Development
DEVELOPMENT
INTRODUCTION TO WEBPAGE DESIGN
WEB
Is a complex system of interconnected elements.
World Wide Web (abbreviated WWW or the Web)
Is an information space where documents and other web resources are identified
by Uniform Resource Locators (URLs), interlinked by hypertext links, and can be
accessed via the Internet.
Uniform Resource Locator (URL)
Is a reference to a web resource that specifies its location on a computer network
and a mechanism for retrieving it. A URL is a specific type of Uniform Resource
Identifier (URI), although many people use the two terms interchangeably.
Hypertext
Is text displayed on a computer display or other electronic devices with references
(hyperlinks) to other text that the reader can immediately access, or where text
can be revealed progressively at multiple levels of detail (also called StretchText).
INTRODUCTION TO WEBPAGE ………….
Hyperlink
hyperlink, or simply a link, is a reference to data that the reader can directly follow
either by clicking, tapping, or hovering.
A user following hyperlinks is said to navigate or browse the hypertext.
Browser
a computer program with a graphical user interface for displaying HTML files, used to
navigate the World Wide Web.
Surf
Is the activity of moving from site to site(from one website to another) on the Internet.
Webpage: a hypertext document connected to the World Wide Web.
INTRODUCTION TO WEBPAGE ………….
Website
Is a collection of related web pages, including multimedia content, typically identified
with a common domain name, and published on at least one web server.
Domain name
Is a unique reference that identifies a web site on the internet, for example loyola.ac.tz
A domain name always includes the top-level domain (TLD), which in loyola case is tz.
the ac part is shorthand for academic and combined .ac.tz is called a second-level
domain (SLD).
Server: Is a computer that provide services to other computers called client
Client: Is a computer that receives services from the server.
INTRODUCTION TO WEBPAGE ………….
COMPONENTS OF URL
1. Protocal: Is the set of rules and conventions governing the interactions between
participants in a distributed computing application. E.g http:// or https://
http stands for HyperText Transfer Protocal
2. Domain name: Is a unique reference that identifies a web site on the internet, for
example loyola.ac.tz
3. Directory: Is a collection of objects
4. Filename and Extension
INTRODUCTION TO WEBPAGE ………….
The World Wide Web (WWW) is a network of online content that is formatted in HTML
and accessed via HTTP.
The term refers to all the interlinked HTML pages that can be accessed over the
Internet. The World Wide Web was originally designed in 1991 by Tim Berners-Lee
while he was a contractor at CERN.
The World Wide Web is what most people think of as the Internet. It is all the Web
pages, pictures, videos and other online content that can be accessed via a Web
browser.
TYPES OF WEBSITE
Static website:
A static website is one that has web pages stored on the server in the format that is
sent to a client web browser.
It is primarily coded in Hypertext Markup Language (HTML); Cascading Style Sheets
(CSS) are used to control appearance beyond basic HTML.
Dynamic website:
A dynamic website is one that changes or customizes itself frequently and
automatically. Server-side dynamic pages are generated "on the fly" by computer code
that produces the HTML (CSS are responsible for appearance and thus, are static files).
Programming languages used to create such website are PHP, Java Servlets, Java Server
Page, Python, Ruby etc.
MAIN CATEGORIES OF WEBSITES:
Less Expensive
Having a website will make promoting your company less expensive. Many versions of
offline advertising available on the internet are sometimes free.
Advertising
There are lots of ways to advertise your products or services through the internet. One
example is Facebook ads, an advertising feature offered through Facebook.
Satisfaction
Make it easy for your customers to purchase from you! Many will be more likely to visit
your website, rather than driving a car to your physical location and browsing for your
products.
Increase Customers
The internet offers a global community. With a website, your business will be visible
around the world which will help you generate more customers.
ADVANTAGES OF HAVING WEBSITE
Accessibility
An online site can be visited any time of the day or night. People will look to your site
instead of going to your shop because it is more accessible.
Access to Info
You can access the progress of your website and view all its pages. You can even make
an update anytime, making it much less expensive than printed material.
Better Relationship
Having a website can build better relationships with your customers. You can send
messages instantly to your customers through email. Also, your customers can review
your products online and can also leave feedback for you and your business.
Increase Sales
You can drive more people to your site by consistently updating and promoting the
contents of your site.
ADVANTAGES OF HAVING WEBSITE
Opportunity
A website gives you the opportunity to prove your credibility. You have to tell your
customers why you deserve their trust through your website.
Long Term Clients
A client is your regular customer. He is buying your products or services daily or
contractually. Having a website gives you a chance to gain more clients that can help
your business grow.
html
Html
Immediately after the doctype comes the htmlelement—this is the root element of the
document tree and everything that follows is a descendant of that root element.
i.e <html> </html>
Head
The head element contains metadata—information that describes the document itself,
or associates it with related resources, such as scripts and style sheets.
WHAT IS HTML?
<!DOCTYPE>
<html>
<body>
<h1>Write Your First Heading</h1>
<p>Write Your First Paragraph.</p>
</body>
</html>
DESCRIPTION OF HTML EXAMPLE
1) It is a very easy and simple language. It can be easily understood and modified.
2) It is very easy to make effective presentation with HTML because it has a lot of
formatting tags.
3) It is a markup language so it provides a flexible way to design web pages along
with the text.
4) It facilitates programmers to add link on the web pages (by html anchor tag) , so it
enhances the interest of browsing of the user.
5) It is platform-independent because it can be displayed on any platform like
Windows, Linux and Macintosh etc.
6) It facilitates the programmer to add Graphics, Videos, and Sound to the web
pages which makes it more attractive and interactive.
HTML TAGS
• HTML tags contain three main parts: opening tag, content and closing tag. But
some HTML tags are unclosed tags.
• When a web browser reads an HTML document, browser reads it from top to
bottom and left to right. HTML tags are used to create HTML documents and
render their properties. Each HTML tags have different properties.
Syntax
• <tag> content </tag>
• HTML Tag Examples
• Note: HTML Tags are always written in lowercase letters.
UNCLOSED HTML TAGS
• Some HTML tags are not closed, for example br and hr.
• <br> Tag: br stands for break line, it breaks the line of the code.
• <hr> Tag: hr stands for Horizontal Rule. This tag is used to put a line
across the webpage.
TAGS
2) Italic Text
If you write anything within <i>............</i> element, is shown in italic letters.
See this example:
<p> <i>Write Your First Paragraph in italic text.</i></p>
3) HTML Marked formatting
If you want to mark or highlight a text, you should write the content within
<mark>.........</mark>.
See this example:
<h2> I want to put a <mark> Mark</mark> on your face</h2>
HTML FORMATTING………….
4) Underlined Text
If you write anything within <u>.........</u> element, is shown in underlined text.
See this example:
<p> <u>Write Your First Paragraph in underlined text.</u></p>
5) Strike Text
Anything written within <strike>.......................</strike> element is displayed
with strikethrough. It is a thin line which cross the statement.
See this example:
<p> <strike>Write Your First Paragraph with strikethrough</strike>.</p>
HTML HEADING
A HTML heading or HTML h tag can be defined as a title or a subtitle which you want to display on the
webpage. When you place the text within the heading tags <h1>.........</h1>, it is displayed on the
browser in the bold format and size of the text depends on the number of heading.
There are six different HTML headings which are defined with the <h1> to <h6> tags.
h1 is the largest heading tag and h6 is the smallest one. So h1 is used for most important heading
and h6 is used for least important.
See this example:
<h1>Heading no. 1</h1>
<h2>Heading no. 2</h2>
<h3>Heading no. 3</h3>
<h4>Heading no. 4</h4>
<h5>Heading no. 5</h5>
<h6>Heading no. 6</h6>
HTML PARAGRAPH
If you put a lot of spaces inside the HTML p tag, browser removes extra spaces
and extra line while displaying the page. The browser counts number of spaces
and lines as a single one.
<p>
I am
going to provide
you a tutorial on HTML
and hope that it will
be very beneficial for you.
</p>
HTML ANCHOR
The HTML anchor tag defines a hyperlink that links one page to another
page. The "href" attribute is the most important attribute of the HTML a tag.
href attribute of HTML anchor tag
The href attribute is used to define the address of the file to be linked. In
other words, it points out the destination page.
The syntax of HTML anchor tag is given below.
<a href = "..........."> Link Text </a>
Let's see an example of HTML anchor tag.
<a href="second.html">Click for Second Page</a>
ATTRIBUTES
HTML img tag is used to display image on the web page. HTML img tag is an empty tag that
contains attributes only, closing tags are not used in HTML image element.
Let's see an example of HTML image.
<h2>HTML Image Example</h2>
<img src="good_morning.jpg" alt="Good Morning Friends"/>
Attributes of HTML img tag
The src and alt are important attributes of HTML img tag. All attributes of HTML image tag are
given below.
1) src
It is a necessary attribute that describes the source or path of the image. It instructs the browser
where to look for the image on the server.
The location of image may be on the same directory or another server.
ATTRIBUTES OF HTML IMG TAG
2) alt
The alt attribute defines an alternate text for the image, if it can't be displayed. The
value of the alt attribute describe the image in words. The alt attribute is
considered good for SEO prospective.
3) width
It is an optional attribute which is used to specify the width to display the image. It
is not recommended now. You should apply CSS in place of width attribute.
4) height
It specifies the height of the image. The HTML height attribute also supports iframe,
image and object elements. It is not recommended now. You should apply CSS in
place of height attribute.
HTML TABLE
HTML table tag is used to display data in tabular form (row * column).
There can be many columns in a row.
HTML tables are used to manage the layout of the page e.g. header
section, navigation bar, body content, footer section etc. But it is
recommended to use div tag over table to manage the layout of the page .
HTML Table Tags
Tag Description
<table> It defines a table.
<tr> It defines a row in a table.
HTML TABLE TAGS
<table>
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Sonoo</td><td>Jaiswal</td><td>60</td></tr>
<tr><td>James</td><td>William</td><td>80</td></tr>
<tr><td>Swati</td><td>Sironi</td><td>82</td></tr>
<tr><td>Chetna</td><td>Singh</td><td>72</td></tr>
</table>
TABLES: ROWSPAN AND COLSPAN
Colspan and Rowspan A table is divided into rows and each row is divided
into cells. In some situations we need the Table Cells span across (or
merged) more than one column or row.
<tr>
<th rowspan="2">Row</th>
<th colspan="4"> Column</th>
</tr>
HTML LISTS
HTML Lists are used to specify lists of information. All lists may contain
one or more list elements. There are three different types of HTML lists:
In the ordered HTML lists, all the list items are marked with numbers. It is
known as numbered list also. The ordered list starts with <ol> tag and
the list items start with <li> tag.
<ol>
<li>Aries</li>
<li>Bingo</li>
<li>Leo</li>
<li>Oracle</li>
</ol>
HTML UNORDERED LIST OR BULLETED
LIST
In HTML Unordered list, all the list items are marked with bullets. It is also
known as bulleted list also. The Unordered list starts with <ul> tag and
list items start with the <li> tag.
<ul>
<li>Aries</li>
<li>Bingo</li>
<li>Leo</li>
<li>Oracle</li>
</ul>
HTML ORDERED LIST | HTML NUMBERED LIST
Type Description
Type "1" This is the default type. In this type, the list items are numbered
with numbers.
Type "I" In this type, the list items are numbered with upper case roman
numbers.
Type "i" In this type, the list items are numbered with lower case roman
numbers.
Type "A" In this type, the list items are numbered with upper case letters.
Type "a" In this type, the list items are numbered with lower case letters.
HTML ORDERED LIST EXAMPLE
<ol>
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ol>
HTML ORDERED LIST EXAMPLE
ol type="I"
Let's see the example to display list in roman number uppercase.
<ol type="I">
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ol>
START ATTRIBUTE
The start attribute is used with ol tag to specify from where to start the list
items.
<ol type="1" start="5"> : It will show numeric values starting with "5".
<ol type="A" start="5"> : It will show capital alphabets starting with "E".
<ol type="a" start="5"> : It will show lower case alphabets starting with
"e".
<ol type="I" start="5"> : It will show Roman upper case value starting with
"V".
<ol type="i" start="5"> : It will show Roman lower case value starting with
"v".
START ATTRIBUTE
Example
<ol type="i" start="5">
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ol>
HTML FORM
The email field validates the text for correct email address. You must use
@ and . in this field.
<form>
<label for="email">Email: </label>
<input type="email" id="email" name="email"/> <br/>
</form>
RADIO BUTTON CONTROL
The radio button is used to select one from multiple options. It is used in gender,
quiz questions etc.
If you use one name for all the radio buttons, only one radio button can be selected
at a time.
<form>
<label for="gender">Gender: </label>
<input type="radio" id="gender" name="gender" value="male"/>Male
<input type="radio" id="gender" name="gender"
value="female"/>Female <br/>
</form>
CHECKBOX CONTROL
The checkbox control is used to check multiple options from given checkboxes.
<form>
Hobby:<br>
<input type="checkbox" id="cricket" name="cricket" value="cricket"/>
<label for="cricket">Cricket</label>
<input type="checkbox" id="football" name="football" value="football"/>
<label for="football">Football</label>
<input type="checkbox" id="hockey" name="hockey" value="hockey"/>
<label for="hockey">Hockey</label>
</form>
54
INTRO TO JAVASCRIPT
CS380
PHP already allows us to create dynamic web pages. Why also use client-
side scripting?
• client-side scripting (JavaScript) benefits:
• usability: can modify a page without having to post back to the server
(faster UI)
• efficiency: can make small, quick changes to page without waiting for
server
• event-driven: can respond to user actions like clicks and key presses
CS380
58 WHAT IS JAVASCRIPT?
59 WHAT IS JAVASCRIPT?
60 JAVASCRIPT VS JAVA
• contained within a web page and integrates with its HTML/CSS content
CS380
61 JAVASCRIPT VS JAVA
+ =
CS380
• similarities:
• both are interpreted, not compiled
• both are relaxed about syntax, rules, and types
• both are case-sensitive
• both have built-in regular expressions for
powerful text processing
CS380
• differences:
• JS is more object-oriented: noun.verb(), less procedural:
verb(noun)
• JS focuses on user interfaces and interacting with a document;
PHP is geared toward HTML output and file/form processing
• JS code runs on the client's browser; PHP code runs on the
web server
JS <3
CS380
HTML
• script tag should be placed in HTML page's head
• script code is stored in a separate .js file
• JS code can be placed directly in the HTML file's body or head (like CSS)
• but this is bad style (should separate content, presentation, and behavior
CS380
65 EVENT-DRIVEN PROGRAMMING
67 EVENT-DRIVEN PROGRAMMING
68 BUTTONS
<button>Click me!</button> HTML
69 JAVASCRIPT FUNCTIONS
function name() {
statement ;
statement ;
...
statement ;
} JS
function myFunction() {
alert("Hello!");
alert("How are you?");
} JS
the above could be the contents of
example.js linked to our HTML page
statements placed into functions can be
evaluated in response to user events
CS380
70 EVENT HANDLERS
<element attributes onclick="function();">...
HTML
<button onclick="myFunction();">Click me!</button>
HTML
• JavaScript functions can be set as event handlers
• when you interact with the element, the function will execute
73 ACCESSING ELEMENTS:
DOCUMENT.GETELEMENTBYID
var name = document.getElementById("id");
JS
<button onclick="changeText();">Click me!</button>
<span id="output">replace me</span>
<input id="textbox" type="text" />
HTML
function changeText() {
var span = document.getElementById("output");
var textBox = document.getElementById("textbox");
textbox.style.color = "red";
}
JS
CS380
74 ACCESSING ELEMENTS:
DOCUMENT.GETELEMENTBYID
document.getElementById returns the
DOM object for an element with a given
id
can change the text inside most
elements by setting the innerHTML
property
can change the text in form controls by
setting the value property
CS380
76 PREETIFY
function changeText() {
//grab or initialize text here
77
78 VARIABLES
var name = expression; JS
79 NUMBER TYPE
var enrollment = 99;
var medianGrade = 2.8;
var credits = 5 + 4 + (2 * 3);
JS
• integers and real numbers are the same type (no int vs. double)
• same operators: + - * / % ++ -- = += -= *= /= %=
• similar precedence to Java
• many operators auto-convert types: "2" * 3 is 6
CS380
81 MATH OBJECT
var rand1to10 = Math.floor(Math.random() * 10 + 1);
var three = Math.floor(Math.PI);
JS
83 LOGICAL OPERATORS
85 BOOLEAN TYPE
var iLike190M = true;
var ieIsGood = "IE6" > 0; // false
if ("web devevelopment is great") { /* true */ }
if (0) { /* false */ }
JS
any value can be used as a Boolean
"falsey" values: 0, 0.0, NaN, "", null, and
undefined
"truthy" values: anything else
converting a value into a Boolean
explicitly:
var boolValue = Boolean(otherValue);
var boolValue = !!(otherValue);
CS380
do {
statements;
} while (condition);
JS
88 POPUP BOXES
alert("message"); // message
confirm("message"); // returns true or false
prompt("message"); // returns user input string
JS
CS380
89 ARRAYS
var name = []; // empty array
var name = [value, value, ..., value]; // pre-filled
name[index] = value; // store element
JS