0% found this document useful (0 votes)
9 views9 pages

JavaScript Client-Side Scripting Guide

The document covers client-side scripting using JavaScript, detailing its functions, data types, variables, operators, control structures, and built-in functions. It also discusses web hosting, including types such as shared, dedicated, and virtual private servers, as well as considerations for buying hosting space and domain name registration. Additionally, it introduces content management systems and responsive web design principles.

Uploaded by

akashinath710
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views9 pages

JavaScript Client-Side Scripting Guide

The document covers client-side scripting using JavaScript, detailing its functions, data types, variables, operators, control structures, and built-in functions. It also discusses web hosting, including types such as shared, dedicated, and virtual private servers, as well as considerations for buying hosting space and domain name registration. Additionally, it introduces content management systems and responsive web design principles.

Uploaded by

akashinath710
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Prepared by Santhosh Kumar S 9526771992 9847366319

Chapter 6
Client Side Scripting Using Java Script
Java Script
Java script is a client side scripting language used to validate data at the client side itself.
This reduces network traffic and workload on the server. It is embedded in HTML document. The
<SCRIPT> tag is used to include scripts in an HTML page. JavaScript was developed by Brendan
Eich .It is supported by almost all web browsers.

<SCRIPT> Tag
The <SCRIPT> tag is used to include scripting code in an HTML page. The Language
attribute of <SCRIPT> tag is used to specify the type of scripting language used.
Example:
<SCRIPT Language=”JavaScript”>
…………….………………
</SCRIPT>
• [Link] ( ) function
The function [Link] is JavaScript command that includes a text in the body
section of the HTML page..

Functions in JavaScript
A function is a self-contained unit of a program that perform a specific task. It is an
independent part of a program, which is executed when it is called. A function is often referred to as
a ‘black box’. Normally functions are placed in the HEAD tag of HTML.
• Defining a function
Functions must be declared before they are used. A function is defined using the function
keyword. The function statements are enclosed in Curley brace. Once a function is defined it can be
called many times. A function has two parts function header and function body.

function print( )
{
[Link](“Welcome to JavaScript Programming”);
}

Computer Science
Prepared by Santhosh Kumar S 9526771992 9847366319

Calling a function
A function can be called using its name.

Data types in JavaScript

Data type specifies the type of data and the operations that can be performed on the data. Data
types in JavaScript is classified into three. The data types in JavaScript are Number, String and
Boolean.
• Number: -They include integers and floating point numbers.
• Strings:-A string is a combination of characters, numbers or symbols enclosed within double
quotes.
• Boolean:-A Boolean data can be either True or False.
Variables in JavaScript
A Variable in JavaScript is declared using the var keyword. A variable is a data type whose
value changes during program execution.
Example:
var a;
var msg =”Hello”;
Note:- Javascript determines the typeof variable only when assigning a value.

Example:-
A web page to find the sum of two numbers
<HTML>
<HEAD>
<TITLE>JAVASCRIPT_DEMO</TITLE>
<SCRIPT Language="JavaScript">
function sum()
{
var a, b, c;
a=10;
b=2;
c=a+b;
[Link]("Sum is");
[Link](c);
}
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT Language="JavaScript">
Computer Science
Prepared by Santhosh Kumar S 9526771992 9847366319

sum( );
</SCRIPT>
</BODY>
</HTML>

Operators
An operator is a symbol used to perform a specific task. Operators in JavaScript are classified
into Arithmetic operator, Relational operator. and Logical operator.
• Arithmetic Operator
Arithmetic operator is used to perform arithmetic operations like addition, subtraction
etc. The operators are +, -, *, /, %, + +, - -
• Relational Operator
Relational operator is used to compare two or more quantities. The operators are <, <=, >,

>=. ! =, = =

• Assignment Operator
The assignment operator(=) operator is used to assign a value to a variable.
Example:- var a=10;
Assigns 10 to the variable a.
• Arithmetic Assignment Operator
The arithmetic assignment operators includes + =, - =, * =, / =, % =. They are used to
simplify the use of assignment operator.
Example:-
a = a+10 is equal to a + =10
a=a%10 is equal to a% =10
• String addition Operator
The + operator can be used to add (Join) two strings together.
Example:-
var a,b,c
a=”Hello”;
b=”How are you”;
c=a+b;
[Link](c);
Output:-
Hello How are you
Computer Science
Prepared by Santhosh Kumar S 9526771992 9847366319

• Number function
The Number( ) function is used to convert a string data into a number.
Example:
Number(“42”); //returns 42

Control structures in JavaScript

Control structures are used to control the flow of a program. The important
Control structures in JavaScript are
• if statement
The if statement executes a group of statements based on a condition.
The syntax is
if(test_expression)
{
Statements;
}
• Switch statement
The branching structure of multiple selection statement is called the switch statement.
Which executes statement based on value of the expression.
The syntax is
switch(expression)
{
case value1:statement1;break;
case value2:ststement2;break;
- -----------------------
Default:statement;
}
• for ............Loop
The for loop executes a group of statements repeatedly based on some condition.
The syntax is
for(initialisation;expression;update_statement)
{
statements;
}
• While ......... Loop
The while loop executes a group of statements repeatedly based on a condition. The syntax
is
while(expression)
{
statements;
}

Computer Science
Prepared by Santhosh Kumar S 9526771992 9847366319

Built-in Functions
Built-in functions are also called methods. The following are the important methods in
JavaScript.
• alert( )
The alert( ) function is used to display a message on the screen.
The syntax is
alert(“message”);
• isNaN( )
The isNaN( ) function is check if a value is a number or not. The function returns true if
the value is a number.
The syntax is
isNaN(test_value);
• toUpperCase ( )
This function converts a lowercase string into an uppercase.
Example:-
var a,b;
a=”abcd”;
b=[Link]( );
[Link](b);
Output:ABCD

• toLowerCase( )
This function converts an uppercase string to lowercase.
• charAt( )
The charAt( ) method returns the character at the specified index in a string. The index
of the first character is 0, the second character is 1, and so on.
Example:-
var str = "HELLO WORLD";
var res = [Link](0);
returns H
• length Property
The length property returns the length of a string (number of characters).

Computer Science
Prepared by Santhosh Kumar S 9526771992 9847366319

Example:-
var a=”Welcome”;
var len=[Link];
[Link](len);
Output:-
7
Accessing values in a textbox using JavaScript
Names are provided to textboxes to access them. The following HTML code is used to
specify name to textbox.
<INPUT Type=”Text” Name=”txt”;
The above textbox can be accessed as
var n= [Link];
typeof Operator
The typeof operator is used to find the type of a javascript variable. It returns a string
indicating the data type of its operand.
Example:-
typeof”Hello” //returns String
typeof 3.14 //returns Number

Event
Event means an action made by the users. Events arte of two types they are Mouse Events
and Key Events.

• Mouse Events

Event Description
onClick This event occurs when the user clicks on an objects
with left mouse button
onMouseEnter This event occurs when the mouse pointer moved on an
object.
onMouseLeave This event occurs when the mouse pointer moved out
of an object.

• Key Events
Event Description
onKeyDown This event occurs when the user press an alpha numeric
key
onKeyLeave This event occurs when the user release the key that was
held down

Computer Science
Prepared by Santhosh Kumar S 9526771992 9847366319

Chapter 7
Web Hosting
Web Hosting
The process of storing web pages on a server is called web hosting. Web hosting is a service
of providing storage space in a web server. The companies that provide web hosting services are
called web hosts. hosting allows individuals and organizations to make their website accessible via
the World Wide Web.
Types of web hosting

The type of web hosting has to be decided by amount of space needed for hosting, number
of visitors expected to visit the website, database and programming language support etc. Web hosts
provide different types of hosting packages. They can be shared hosting, virtual hosting and
dedicated hosting.

• Shared hosting:-
Shared hosting is the most common type of web hosting. It is called shared because
many websites are stored on one web server connected to the Internet. They share resources like
RAM; CPU etc .Shared hosting is not suitable for websites with high bandwidth, large storage space
etc. It is not suitable for small sites with less traffic. Shared servers are cheaper and easy to use. The
main dis-advantage of shared hosting is that other sites will slow down if any one of the site has
heavy traffic as bandwidth is shared by many sites.

• Dedicated hosting:-
In dedicated hosting a web site uses an entire server and its resources. The web
server is not shared with other servers. It is mostly used by websites that receive a large volume of
traffic. The web sites of large organizations, government departments etc use dedicated web
hosting. The advantage of dedicated web hosting is that servers are hosted in data center which has
internet connection, uninterrupted power supply etc.
Co-location is a form of dedicated hosting in which the client can use their own server and
other facilities are provided by service provider.

• Virtual Private Server:-

A virtual Private Server(VPS) is a physical server that is virtually partitioned into


several servers using the virtualization technology..Each VPS works similar to dedicated server and
has its own separate operating system, web Server software etc. Each VPS works as a fully
independent web server. The user of VPS can install and configure any type of [Link] is
also called virtual dedicated server (VDS).This type of hosting is suitable for websites that requires
more features at less expense. Some popular virtualization software’s are VMware, Free VPS,
Virtual box, Microsoft Hyper-V etc.

Computer Science
Prepared by Santhosh Kumar S 9526771992 9847366319

Buying Hosting Space

The process of storing web pages on a server is called web hosting. Several factors are to be
considered while purchasing hosting space such as amount of space needed, support technology,
web server (Windows or Linux Server), database facility etc. We can choose any server. Other
features like database support, e-mail facility, can also be considered while choosing the web host.

Domain name registration

Domain names are used to identify a web site on the internet. Most web hosting companies
offer domain registration facility. The domain name chosen must be unique. It can be done using
the website [Link] which checks domain name with ICANN (Internet Corporation for
Assigned Names and Numbers) database. When a user inputs the domain name the web page will
be displayed using DNS server. The domain name is connected with IP address of the web server
using address record.

FTP client software

FTP client software is used to transfer files of a web site to a web server. FTP client
software establishes a connection with a remote server and is used to transfer files from our
computer to server. To connect to an FTP server, FTP client software requires a user name,
password and the domain name. The SSH FTP (SFTP) protocol is used to send user name and
password in an encrypted form to the web server. SFTP uses SSH protocol which provides facilities
for secure file transfer. Once the client is authenticated the client can upload files. Some of the
popular FTP clients are FileZilla, CuteFTP, Smart FTP ..etc.

Free hosting

Free hosting provides web hosting services free of charge. The service provides displays
advertisements in websites to meet the expenses. They often allows only limited support. Free web
hosting services usually provide either their own subdomain or as a directory service for accessing
our websites.

Disadvantages of free web hosting are


1) The free hosting plans do not provide the separate domain name. Instead, they only offer
the sub domain upon their own domain name.
2) There is no customer support.
3) Limited Bandwidth and Speed

Computer Science
Prepared by Santhosh Kumar S 9526771992 9847366319

Content Management System (CMS)

A content management system is a web based software which allows creating, publishing,
editing and modifying web sites..It provides templates for design and manages attractive
web sites. CMSs are often used in blogs, shopping sites. The content management system (CMS)
has two Elements Content management application (CMA) and Content display application (CDA)
.The main advantage of CMS is nontechnical people can manage the contents of web sites.
Also people who has no knowledge of web programming can create dynamic web sites.
Joomla and Wordpress are examples of content management systems.

Advantages of Content Management Systems are,

[Link]-technical people can easily create and manage web sites.


[Link] is easy to maintain CMS based sites.
[Link] changes are simple.

Responsive web design

Responsive web design is an approach to web design aimed at providing an optimal


viewing and interactive experience. It makes your web page look good on all devices (desktops,
tablets, and phones).The term ‘Responsive Web Designing’ was coined by Ethan Marcotee.
Responsive web designing uses flexible images, videos, layouts etc..

Computer Science

You might also like