HTML
HTML
-------------------------------------
Client(Machine)->Send request->Server(Machine)->Response
Protocol==>Set of rules that describes how the webpages transfer on the web.
HTTP==>Hyper Text Transfer protocol =>how the webpages transfer on the web
FTP =>File Transfer protocol =>File transfering
SMTP =>Simple Mail Transfer protocol =>Mail Transfer
Website=>Collection of webpages.
Webpage=>Pages on the web collection of hyper text,hyper link,images.
Picture files:
.jpg (JPEG- Joint Photographic Experts Group)
.gif (GIF - Graphic Interchange Format)
.png(portable network graphics)
.bmp (BMP - Bitmap)
<BODY> tag:
Attributes:
BGCOLOR - Background color
TEXT - Text color
BACKGROUND - Background picture file name.
<FONT> tag
Attributes:
FACE = "Arial"
"Courier New"
SIZE = "1"
= "12"
COLOR="RED"
="BEACH"
E.G
<p Align="center">
<FONT SIZE="4" COLOR="GREEN">
With <FONT SIZE="10" COLOR="BLUE">HTML</FONT> we can create documents that contain Formatted Text
</FONT>
</p>
///////////////////////////////////////////////////////////////
Attributes:
SIZE = "5" - thickness of the line (5 pixels)
WIDTH = "50%" - length of the line; 100% by default
ALIGN ="LEFT"
="RIGHT"
="CENTER"
COLOR ="red"
Attributes
---------
1)behavior
i)Scroll
ii)Slide
iii)Alternate
2)direction
i)right
ii)left
iii)down
iv)up
3)scrollamount- used to specify the speed of our text or images.
4)scrolldelay- used to specify the delay of our text or images.
List
-----
--> To display the related items one by one.
Types of List
----------------
Basically there are 3 types of list.They are
Tables
--------
-->To display the data in Table format.
Attributes
-----------
border
bgcolor
colspan
rowspan
cellpadding
cellspacing
subtags
----------
<tr></tr> - tablerow
<th></th> - table head
<td></td> - table data
Four Elements
------------------
1.Rowspan-To combine the rows
2.Colspan-To combine the columns
3.Cellpadding-To mention the space between a cell and the text.
4.Cellspacing-To mention the space between the cells.
Forms
-----
-->Used to get user input.
Tag
---
1.<form></form>
2.<input type=name of the control..> --> Used to create a control.
Controls
------------
1.Textbox --> Used to get the User Input
2.Checkbox --> Used to Choose more than one option at the same time
3.Radio Button --> Used to select only one option at the same time
4.Button --> Used to submitt the user input values
5.Menu --> Used to create a list of items in a single control
Fieldset
-----------
-->Used to give a name to group of controls.
Legend
------
--> It is a sub element of Fieldset.
--> It is used to give heading of the Fieldset Control.
HTML DHTML
--------- --------
1.Static -individual Dynamic -multiple
2.No Security Security
Types of Styles
---------------
1.Inline style
2.Embedded style
3.External style
4.User defined style.
Evolution of CSS
-----------------
1.CSS1 is the 1st version.It includes font,font style,margins & applying more colors.
2.CSS-p is next version of CSS1.It specify the positioning of web pages.But it was not supported by browser like
IE,Netscape navigator.
3.CSS2 is next version of CSS-p.It includes all the features of CSS-P and inclued some additional features like making
web pages accessible to physically impaired people & making web pages uniformly visible on different devices.
4.CSS3 is under development.
JavaScript
----------
*Java Script is programming language
*Used to validate the input values and display some messages to the user.
3 Layers
------------
1.Presentation Layer(PL)
2. Business Layer(BL) ==>Interface b/w Presentation Layer and database Layer
3. Database Layer(DL)
Task of Client
--------------
1.Verifying the input values.
2.Confirming with the user for specific action.
3.Displaying information,warning and error messages.
Task of Server
--------------
1.Accessing database or files to retrieve values.
2.Storing and maintaing client information.
3.Main purpose is used to store the data or information.
Using JavaScript
----------------
There are three ways that JavaScript can be used within an HTML file.
It can be put within
1.<SCRIPT> tags within the <HEAD> tag (header scripts),
2. Within <SCRIPT> tags within the <BODY> tag (body scripts), or
3. Called directly when certain events occur.
JavaScript is put inside the <HEAD> tag primarily when you are initializing variables and creating functions that will be
used throughout the entire script. Code here is executed once, when the page is loaded.
Any of these event handlers can be added to any HTML tag which can cause the event to occur.
For example, the onLoad event handler can be added to the <BODY> tag, and the event will be called when the page
has completed loading.
NOSCRIPT ELEMENT
----------------
-->Used to check whether our browser support javascript or not.
Eg:
----
<html>
<body>
<noscript>
<h1>This Browser does not support Javascript.</h1>
</noscript>
<h1>Welcome to Javascript</h1>
</body>
</html>
Javascript Keywords
------------------------
A keyword is a reserved word that indicates a particular action or a command to be implemented when used within
the script.Keywords are predefined terms that can't be used as an object name or function name or a variable name.
There are lot of keywords.They are
1.break
2.continue
3.do
4.for
5.import
6.new
7.this
8.void
9.case
10.default
11.else
12.function
13.in
14.return
15.typeof
16.while
17.comment
18.delete
19.export
20.if
21.label
22.switch
23.var --> Used for Variable Declaration
24.with
Built-in Functions
-----------------------
JS provides different built-in functions,which a programmer can use directly within the script.
Java Script
-----------
* It is a programming language.
* document.write("Sample")
* Case-sensitive language
Variables
------------
It is a location of memory address where the value has been stored.
Variable Declaration
--------------------
var,var1,var2,.....
Ex:
---
var a,b,c
Initilaization
--------------
var1=value
var2=value
Ex:
---
a=20
b=30
Parsing
--------
1. parseInt()
2. parseFloat()
3. parseDouble()
Operators
------------
1. Arithmetic Operator => +, -, * , / , %
2. Relational Operator => < , >, <=, >=, ==, !=
3. Logical Operator => &&(AND), ||(OR) , !(NOT)
4. Assignment Operator => =, +=, -=, *=, /=, %=
5. Ternary or condtional Operator => condition?true_statement:false_statement
6. Unary Operator => ++, --
Control Structures
------------------
1. if()
i. if ... else
--------------
Syntax:
-------
if(condition)
{
true-Statement;
}
else
{
false-Statement;
}
ii. if ... else if ...else
--------------------------
Syntax:
--------
if(condition1)
{
Statement1;
}
else if(Condition2)
{
Statement2;
}
else
{
Statement3;
}
iii.Nested if
-------------
Syntax:
-------
if(Condition1)
{
if(Condition2)
{
Statement1;
}
else
{
}
}
2. switch()
-----------
switch(exp)
{
case exp1:
statement1;
break;
case exp2:
statement2;
break;
case exp3:
statement3;
break;
.
.
.
default:
default_statement;
break;
}
Looping Structure
----------------------
Until the condition is true same statements repeated...
1. while
Syntax:
---------
var_initilaization
while(condition)
{
block_of_Statement
var increment or decrement
}
2. do while
Syntax
---------
var_initilaization
do
{
block_of_Statement
var increment or decrement
}
while(condition)
3. for
Syntax
---------
for(var_initialization;condition;var increment (or) decrement)
Array
-------
It is a collection of related dataitems.
Declaration
--------------
var_name=new Array(size)
Ex:
----
a=new Array(5)
a[0],a[1],a[2],a[3],a[4]
Array index start at 0th index.
Function
-----------
=> A function is a sub program, that accepts inputs as arguments/parameters,
and may returns results.
Function Definition
------------------------
function fun_name(argument1,args2,....)
{
block_of_statements;
}
Function calling
--------------------
fun_name(args1,args2,...)
Event Handling
-------------------
1. Click => onClick
2. Mouse Move => onMouseMove
3. Mouse Over => onMouseOver
4. Double Click => ondblClick
HTML JavaScript
A Script is a small program which is used with HTML to make web pages more attractive, dynamic and
interactive, such as an alert popup window on mouse click. Currently, the most popular scripting
language is JavaScript used for websites.
Example:
<html>
<body>
<button type="button"
onclick="document.getElementById('demo').innerHTML = Date()">
<p id="demo"></p>
</body>
</html>
It is mainly used to manipulate images, form validation and change content dynamically.
JavaScript uses document.getElementById() method to select an HTML element.
Example:
<html>
<body>
<p id="demo"></p>
<script>
</script>
</body>
</html>
HTML provides event handler attributes which work with JavaScript code and can perform
some action on an event.
Syntax:
<element event = "JS code">
Example:
<html>
<body>
<h2>Click Event Example</h2>
<p>Click on the button and you csn see a pop-up window with a message</p>
<input type="button" value="Click" onclick="alert('Hi,how are you')">
</body>
</html>
Example:
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
function myFunction() {
</script>
</body>
</html>
Example:
<!DOCTYPE html>
<html>
<body>
<script>
function myFunction() {
document.getElementById("demo").style.fontSize = "25px";
document.getElementById("demo").style.color = "brown";
document.getElementById("demo").style.backgroundColor = "lightgreen";
</script>
<button type="button" onclick="myFunction()">Click Me!</button>
</body>
</html>
Example:
<!DOCTYPE html>
<html>
<body>
<script>
function light(sw) {
var pic;
if (sw == 0) {
pic = "pic_lightoff.png"
} else {
pic = "pic_lighton.png"
document.getElementById('myImage').src = pic;
</script>
<img id="myImage" src="pic_lightoff.png" width="100" height="180">
<p>
</p>
</body>
</html>
Syntax:
<html>
<head>
</head>
<body>
<h2>External JavaScript Example</h2>
<form onsubmit="fun()">
<input type="submit">
</form>
</body>
</html>
JavaScript code:
function fun() {
var x = document.getElementById("frm1").value;
Example
1. <p>An <abbr title = "Hypertext Markup language">HTML </abbr>language is used to
create web pages. </p>
Test it Now
Output:
2. Marked tag:
The content written between <mark> and </mark> tag will show as yellow mark on browser. This tag
is used to highlight a particular text.
Example
1. <p>This tag will <mark>highlight</mark> the text.</p>
Test it Now
Output:
3. Strong text:
This tag is used to display the important text of the content. The text written between <strong> and
</strong> will be displayed as important text.
Example
1. <p>In HTML it is recommended to use <strong>lower-
case</strong>, while writing a code. </p>
Test it Now
Output:
4. Emphasized text
This tag is used to emphasize the text, and displayed the text in italic form. The text written between
<em> and </em> tag will italicized the text.
Example
1. <p>HTML is an <em>easy </em>to learn language.</p>
Test it Now
Output:
5. Definition tag:
When you use the <dfn> and </dfn> tags, it allow to specify the keyword of the content. Following
is the example to show how to definition element.
Example
1. <p><dfn>HTML </dfn> is a markup language. </p>
Test it Now
Output:
6. Quoting text:
The HTML <blockquote> element shows that the enclosed content is quoted from another source.
The Source URL can be given using the cite attribute, and text representation of source can display
using <cite> ..... </cite>element.
Example
1. <blockquote cite="https://www.keepinspiring.me/famous-
quotes/"><p>”The first step toward success is taken when you refuse to be a captive of
the environment in which you first find yourself.”</p></blockquote>
2. <cite>-Mark Caine</cite>
Test it Now
Output:
7. Short Quotations:
An HTML <q> ....... </q> element defines a short quotation. If you will put any content between <q>
....... </q>, then it will enclose the text in double quotes.
Example:
1. <p>Steve Jobs said: <q>If You Are Working On Something That You Really Care About,
You Don?t Have To Be Pushed. The Vision Pulls You.</q>?</p>
Test it Now
Output:
8. Code tags
The HTML <code> </code> element is used to display the part of computer code. It will display the
content in monospaced font.
Output:
9. Keyboard Tag
In HTML the keyboard tag, <kbd>, indicates that a section of content is a user input from keyboard.
Output:
10. Address tag
An HTML <address> tag defines the contact information about the author of the content. The content
written between <address> and </address> tag, then it will be displayed in italic font.
Currently, there ares three video formats supported for HTML video tag:
mp4
webM
ogg
EXAMPLE
-------
<html>
<body>
</body>
</html>
Audio
-----
HTML Audio Tag
HTML audio tag is used to define sounds such as music and other audio clips. Currently there are three supported file
format for HTML 5 audio tag.
mp3
wav
ogg
Example
--------
<html>
<body>
<audio controls>
<source src="koyal.mp3" type="audio/mpeg">
Your browser does not support the html audio tag.
</audio>
</body>
</html>