You are on page 1of 9

UNIT II

SCRIPTING ESSENTIALS
Need for Scripting Languages
• Definition Scripting Language: A scripting
language is a programming language designed
for integrating and communicating with other
programming languages.
• Some of the most widely used scripting
languages are
– HTML, JavaScript, VBScript, PHP, Perl, Python,
Ruby, ASP and so on.
• In general, scripting languages are easier to learn and
faster to code in than more structured and compiled
languages such as C and C++.
• Scripting languages are useful tool for developing
interactive web pages with minimum efforts.
• Scripting languages are often interpreted (rather than
compiled).
• The scripting languages are useful for producing
dynamic web contents.
• That means web page can be changed using user input.
Advantages of Scripting Languages
Types of Scripting Languages
1. There are two types of scripting languages
2. Client side scripting languages
3. Server side scripting Languages.
• Client Side Scripting Languages
• The client side scripting is used to create the web pages as
a request or response to server. These pages are displayed
to the user on web browser.
– For example - HTML, CSS, JavaScript, PHP.
• Server Side Scripting Languages
• Server Side Scripting Languages -The server side scripting
is used to create the web pages that provide some
services. These scripts generally run on web servers.
– For example - ASP, JSP, Servlet, PHP
Difference between Client Side Scripting and Server
Side Scripting
• HTML to define the content of web pages
• CSS to specify the layout of web pages
• JavaScript to program the behavior of web
pages
Examples based on Scripting Languages

• Write a JavaScript program to count the


number of unique alphabets present in the
given string .
< !DOCTYPE html>
< html >
<head>
<title > Finding number of alphabets in String</title>
</head>
<body>
<strong>
<script type="text/javascript">
var sl="Hello";
document. write("Given string is : "+sl +"<br>");
document. write("Number of alphabets in given string are:
"+sl.length+"<br>");
</script>
</strong>
</body>
</html>
• output:
– Given string is :hello
– Number of alphabets is given string are:5

You might also like