Professional Documents
Culture Documents
Lec 01 Web Eng-1
Lec 01 Web Eng-1
Lecture 01
1
Shahab Ul Islam
BS(Information Technology) IBMS UAP 2012
MS(Information Technology) IBMS UAP 2016
(Gold Medalist)
2
A Nice Saying
I keep 6 honest serving men.
They taught me all I knew.
Their names are:
WHAT and WHY and WHEN and HOW and WHERE and
WHO.
(R. Kipling)
3
Let start the Course…..
4
Web Engineering
Web Engineering – is the application of systematic,
disciplined and quantifiable approaches to the design,
production, deployment, operation, maintenance and
evolution of Web-based software products.
[IEEE, 1993]
5
6
World Wide Web
It is a collection of textual documents and other
resources, linked by hyperlinks and URLs,
transmitted by web browsers and web servers.
It is also an application "running" on the Internet.
Viewing a web page on the World Wide Web
normally begins either by typing the URL of the
page into a web browser
7
WWW Structure
8
Clients and Servers
HTTP is a Protocol for client/server communication
9
Uniform Resource Locators (URLs)
Path
Identifies a file within a
hierarchical directory
Host name
structure on the server
Identifies a particular
computer somewhere on the
Prefix Internet
13
WWW Working
Browser resolves the server-name portion of the URL
(en.wikipedia.org) into an Internet Protocol address using
DNS.
DNS or Domain Name System (DNS) is a globally
distributed database.
Returns an IP address such as 208.80.152.2.
The browser then requests the resource by sending an
HTTP request across the Internet to the computer at that
particular address.
The computer receiving the HTTP request delivers it to
Web server software listening for requests on port 80.
14
HTML
HTML stands for Hyper Text Markup Language
HTML is not a programming language, it is a markup
language
A markup language is a set of markup tags
HTML uses markup tags to describe web pages
HTML tags are keywords surrounded by angle brackets like
<html>
HTML tags normally come in pairs like <b> and </b>
The first tag in a pair is the start tag, the second tag is
the end tag
Start and end tags are also called opening tags and closing
tags
15
Best free web development IDE for JavaScript,
HTML and CSS
Notepad++
Dreamweaver
webuilder
Light Table
Netbeans
Brackets
Komodo Edit
16
HTML Documents = Web Pages
<body>
content goes here
</body>
</html>
17
Creating and saving Webpages
Open Notepad (notepad++)
Write your code
Once you finished the content, click on File ->
Save
Give a file name e.g myfirstpage.html
Click on Save
Run your webpage where it is stored.
18
HTML Tags
HTML Headings
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
HTML Paragraphs
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML Elements
An HTML element is everything from the start tag to the end
tag:
19
HTML Tags
<b> bold text
<big> big text
<small> small
<i> italic
<em> emphasized
<sub> subcripted
<sup> superscripted
<img src="smiley.gif" alt="HTML tutorial" width=“20"
height=“20" />
<a href="http://www.yahoo.com/">Yahoo</a>
20
HTML Attributes
21
HTML Forms
- Forms are used in the creation of interactive features.
- Forms added new features to HTML Page.
- Forms include
- Comment Response Form
- Order entry form
- Subscription Form
- Registration form
22
How Forms are used in HTML
Once a form is filled , the specified data in different fields are sent to some where
(specified by a URL) .
A program on remote web server will then parse the submitted information and do
something with it.
The program that handle the incoming form submitted data usually are Common
Gateway Interface (CGI).
23
HTML Forms cont….
- Form contain
- regular text
- HTML elements like tables
- Forms elements like check boxes, pull down menus and text field.
- Form elements also called Forms control OR Forms fields.
<form>
……
input elements
…...
</form>
24
HTML Forms - The Input Element
25
Text Fields
<html>
<body>
<form>
First name: <input type="text" name=“Firstname" /><br />
Last name: <input type="text" name=“Lastname" />
</form>
</body>
</html>
26
Text Area
<textarea> tag defines a multi line text input.
<html>
<input type ="submit" value ="ok"> <br>
<textarea rows="5" cols="50"> </textarea>
</html>
27
Password Field
Password Field define password .
<html>
<body>
<form>
Password: <input type="password" name="pwd" />
</body>
</htm>
28
Radio Buttons
</form>
29
Checkboxes
<form>
I have a car
</form>
30
Drop Down Menu
<html>
<head>
<title>My Page</title>
</head>
<body>
<select name="mydropdown">
<option value="Milk">Fresh Milk</option>
<option value="Cheese">Old Cheese</option>
<option value="Bread">Hot Bread</option>
</select>
</body>
</html>
31
Submit Button Cont..
<form>
Username: <input type="text" name="user" />
<input type="submit" value="Submit" />
</form>
32
HTML Multimedia
33
Plugins
- A Plugin is a small computer program that extends the
standard functionality of a web browser.
34
Multimedia Formats
- Multimedia elements also have their own file formats
with different extensions like .swf, .wmv, .mp3,mp4.etc
- Few popular extensions are:
35
Multimedia Formats Cont..
- MPEG(.mpg):
The MPEG (Moving Pictures Expert Group) format is
the most popular format on the Internet. It is cross-
platform, and supported by all the most popular web
browsers.
- QuickTime (.mov):
The QuickTime format is developed by Apple.
- RealVideo (.rm):
The RealVideo format was developed for the Internet by
Real Media.
36
Multimedia Formats Cont..
37
Sound Formats
MIDI (.mid, .midi):
The MIDI (Musical Instrument Digital Interface) is a
format for electronic music devices.
RealAudio (.rm, .ram)
Wave (.wav)
WMA (.wma)
MP3 (.mp3)
mpga
38
Add Audio and video to Your Site
- The Easiest Way to Add Audio and video is ,
39
CSS (Cascading Style Sheet)
- CSS is short for Cascading Style Sheets.
40
WHY CSS?
- Web sites designed in CSS are faster to change and
update. Because the coding is reduced the pages are
more efficient and require less bandwidth .
41
CSS Cont…
- With CSS you can add style (fonts, colors, spacing, size.
links) to web documents.
42
CSS Syntax
43
CSS Cont…
- h1{font-size: 28pt;}
Rule - {font-size: 28pt;}
44
CSS Cont….
<html>
<head>
<title> First CSS Example</title>
<style>
h1 {font-size: 28pt ;
color: red ;
font-family: Impact ;}
</style>
</head>
<body>
<h1> New HTML with style</h1>
</body>
</html>
45
CSS Example
body
{
background-color:yellow;
}
h1
{
font-size:36pt;
}
h2
{
color:blue;
}
p
{
margin-left:50px;
}
46
CSS Example cont…
<html>
<head>
<link rel="stylesheet" type="text/css" href="ex1.css" />
</head>
<body>
</body>
</html>
47
CSS Comments
- Comments are used to explain your code, and may help
you when you edit the source code at a later date.
- CSS comment begins with "/*", and ends with "*/", like this:
/*This is a comment*/
p
{
text-align:center;
/*This is another comment*/
color:black;
font-family:arial;
}
48
CSS cont…
- A CSS declaration always ends with a semicolon.
- p {color:red;text-align:center;}
- To make the CSS more readable, you can put one declaration on
each line, like this:
Example
p
{
color:red;
text-align:center;
}
49
Three Ways to Insert CSS
- Inline style
50
External Style Sheet
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
</head>
51
External Style Sheet cont…
52
Internal Style Sheet
53
CSS Cont….
<html>
<head>
<title> First CSS Example</title>
<style>
h1 {font-size: 28pt ;
color: red ;
font-family: Impact ;}
</style>
</head>
<body>
<h1> New HTML with style</h1>
</body>
</html>
54
Inline Styles
- An inline style loses many of the advantages of style
sheets by mixing content with presentation.
<html>
<head>
<p style="color:blue;margin-left:20px">This is a
paragraph.</p>
</head>
</html>
55
Cascading order
- Browser default
- External style sheet
- Internal style sheet (in the head section)
- Inline style (inside an HTML element)
56
The id and class Selectors
57
The id Selector
- The id selector is used to specify a style for a single,
unique element.
58
The id Selector cont…
<html>
<head>
<style type="text/css">
#para1
{
text-align:center;
color:red;
}
</style>
</head>
<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected by the style.</p>
</body>
</html>
59
Class Selector
60
Class Selector cont…
<html>
<head>
<style type="text/css">
.center
{
text-align:center;
}
</style>
</head>
<body>
<h1 class="center">Center-aligned heading</h1>
<p class="center">Center-aligned paragraph.</p>
</body>
</html>
61
Java Script
62
JavaScript
JavaScript started life as LiveScript, but Netscape
changed the name, possibly because of the excitement
being generated by Java.to JavaScript.
JavaScript made its first appearance in Netscape 2.0 in
1995 with a name LiveScript.
63
JavaScript cont..
JavaScript is a lightweight programming language with
object-oriented capabilities that allows you to build
interactivity into otherwise static HTML pages
64
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.
65
Java Script cont….
- The HTML <script> tag is used to insert a javaScript into an
HTML page.
<html>
<body>
<script type="text/javascript">
document.write("Hello World!")
</script>
</body>
</html>
66
General format
<html>
<body>
<script type="text/javascript">
.....
…..
</script>
</body>
</html>
67
How to Handle Simple Browsers
68
Simple Browser cont…
<html>
<body>
<script type="text/javascript">
<!--
document.write("Hello World!")
-->
</script>
</body>
</html>
69
Case Sensitivity:
JavaScript is a case-sensitive language. This means that
language keywords, variables, function names, and any
other identifiers must always be typed with a consistent
capitalization of letters.
So identifiers Time, TIme and TIME will have different
meanings in JavaScript.
NOTE: Care should be taken while writing your variable
and function names in JavaScript.
70
Comments in JavaScript
JavaScript supports both C-style and C++-style
comments, Thus:
Any text between a // and the end of a line is treated
as a comment and is ignored by JavaScript.
71
JavaScript cont…
<script language="javascript" type="text/javascript">
<!-- // This is a comment. It is similar to comments in C++
/* * This is a multiline comment in JavaScript * It is very
similar to comments in C Programming
*/ //-->
</script>
72
JavaScript cont…
All the modern browsers come with built-in support for
JavaScript. Many times you may need to enable or disable
this support manually.
73
JavaScript in External File
<html>
<head>
<script type="text/javascript" src="filename.js" >
</script>
</head>
<body> ....... </body>
</html>
74
Save as file name.js
function sayHello()
{
alert("Hello World")
}
75
JavaScript Data Types
76
JavaScript Variables:
Like many other programming languages, JavaScript has
variables.
77
Variable Scope:
Global Variables: A global variable has global scope
which means it is defined everywhere in your JavaScript
code.
78
var myVar = "global"; // Declare a global variable
function checkscope( )
{
var myVar = "local"; } // Declare a local variable
79
If else Statements
<script type="text/javascript">
<!-- var age = 15;
if( age > 18 )
{
document.write("<b>Qualifies for driving</b>"); }
Else
{ document.write("<b>Does not qualify for
driving</b>");
}
//--> </script>
80
If else If statements
<script type="text/javascript">
<!-- var book = "maths";
if( book == "history" )
{
document.write("<b>History Book</b>");
}
else if( book == "maths" )
{ document.write("<b>Maths Book</b>");
}
else if( book == "economics" )
{ document.write("<b>Economics Book</b>"); }
Else
{
document.write("<b>Unknown Book</b>"); } //-->
81
Switch statement
The switch statement is used to perform different
actions based on different conditions.
Syntax:
switch (expression)
case condition 1: statement(s) break;
case condition 2: statement(s) break; ... case condition
n: statement(s) break; default: statement(s)
82
While loop
The while loop loops through a block of code as
long as a specified condition is true.
Syntax:
while (condition) {
code block to be executed
}
Example:
while (i < 10) {
text += "The number is " + i;
i++;
}
83
Do while
This loop will execute the code block once, before checking
if the condition is true, then it will repeat the loop as long
as the condition is true.
Syntax:
do {
code block to be executed
} while (condition);
Example:
do {
text += "The number is " + i;
i++;
}
while (i < 10);
84
The for Loop
<script type="text/javascript">
<!–
var count;
document.write("Starting Loop" + "<br />");
for(count = 0; count < 10; count++)
{
document.write("Current Count : " + count );
document.write("<br />");
}
document.write("Loop stopped!"); //--> </script>
85
Function
A function is a group of reusable code which can be called
anywhere in your program.
86
Function
The most common way to define a function in
JavaScript is by using the function keyword, followed
by a unique function name, a list of parameters (that
might be empty), and a statement block surrounded
by curly braces.
The basic syntax is shown here
<script type="text/javascript">
function functionname(parameter-list)
{ statements }
</script>:
87
Calling Function example
<script type="text/javascript">
function sayHello(name, age)
{
alert( name + " is " + age + " years old.");
}
sayHello('Zara', 7 );
</script>
88
Event
JavaScript's interaction with HTML is handled
through events that occur when the user or browser
manipulates a page.
89
onclick Event Type
This is the most frequently used event type which occurs when a user clicks mouse left
button. You can put your validation, warning etc against this event type.
<html>
<head>
<script type="text/javascript">
function sayHello() {
alert("Hello World")
}
</script>
</head>
<body>
<input type="button" onclick="sayHello()" value="Say Hello" />
</body>
</html>
90
onmouseover and onmouseout
These two event types will help you to create nice effects
with images or even with text as well. The onmouseover
event occurs when you bring your mouse over any
element and the onmouseout occurs when you take your
mouse out from that element.
91
<html>
<head>
<script type="text/javascript">
<!--
function over() {
alert("Mouse Over");
}
function out() {
alert("Mouse Out");
}
//-->
</script>
</head>
<body>
<div onmouseover="over()" onmouseout="out()" >
<h2> This is inside the division </h2>
</div>
</body>
</html>
92
HTML 4 Standard Events
Event Value Description
onmouseover script Script runs when mouse pointer moves over an element
93
alert dialog
An alert dialog box is mostly used to give a warning message to
the users.
Like if one input field requires to enter some text but user does
not enter that field then as a part of validation you can use
alert box to give warning message.
<head>
<script type="text/javascript">
<!-- alert("Warning Message"); //--> </script> </head>
Alert box gives only one button "OK" to select and proceed.
94
Confirmation Dialog Box:
confirmation dialog box is mostly used to take user's
consent on any option. It displays a dialog box with
two buttons: OK and Cancel.
95
example
<head>
<script type="text/javascript">
<!-- var retVal = confirm("Do you want to continue ?");
if( retVal == true )
{
alert("User wants to continue!");
return true;
}
Else
{
alert("User does not want to continue!");
return false;
}
//--> </script> </head>
96
Lab Task 01: Marks=02
Create Your C.V in HTML
E.g
Name
SSC, HSSC marks, Board
Your address
Semester GPAs
Advantages of Web Engineering course
97
Assignment # 01
Design a registration form using HTML, CSS and Java
Script.
Registration form
98