1 of 13

Web Technologies

Introduction to Java Script

Smt M.Jeevana Sujitha

Assistant Professor

Department of Computer Science and Engineering

SRKR Engineering College, Bhimavaram, A.P. - 534204

2 of 13

OBJECTIVES

The Objectives of this lecture are

  • To learn about introduction of Java Script.

3 of 13

Need of Java Script

  • HTML is used to create static web pages, but it has many limitations one of those is interactivity.
  • We can not create interactive web pages using HTML.
  • Hence, Java script is designed to add the interactivity in the HTML pages.

4 of 13

Introduction of Java Script

  • JavaScript is invented in 1996 by Netscape.
  • JavaScript is a web-based, client-side programming

language that runs in the browser.

  • It is used to make interactive web pages that can add life

to boring static HTML web pages.

  • JavaScript is used mainly to add functionality to the web

pages, validate forms, invoke actions based on user's

events etc.

  • It is the most popular scripting language on internet and

works in all major browsers.

5 of 13

Introduction of Java Script

  • The java script code is executed when the user submits the form.
  • If all the entries are valid then they would be submitted to the web server.

6 of 13

Features of Java Script

  • It is an Object-based Scripting Language.
  • Java script code as written between <script>-----</script>

tags

  • All Java script statements end with a semicolon
  • Java script ignores white space
  • Java script is case sensitive language
  • Script program can be saved as either .js or .html

7 of 13

Advantages of Java Script

  • Simple web applications such as calculator and calendar can be developed using java script.
  • It Can put dynamic text into an Html page.
  • Example: document.write(“<h1>”+name+”</h1>”);
  • It can react to user events.
  • It can be used to validate the Html form data.
  • It can be used to create cookies.

8 of 13

Limitations of Java Script

  • Client-side JavaScript does not allow the reading or writing of files. This has been kept for security reason.
  • It can not be used for networking applications.

9 of 13

Syntax of Java Script

  • It can be implemented using java script statements that are placed within the

</script> tags in a web page.

<script>

  • Syntax:

<script>

Java script code

</script>

10 of 13

Syntax of Java Script

  • Attributes of script tag:
  • language:- specifies what language we are using
  • type:- to indicate the scripting language in use and its value should be set to “text/javascript”

11 of 13

Java Script placement in HTML file

  • Script in <head>…..</head> section
  • Script in <body>…..</body> section
  • Script in both <head>….</head> and

<body>…..</body> section.

  • Script in an external file and then include in <head>…..</head> section.

12 of 13

<html>

<body>

<script language="javascript" type="text/javascript">

document.write("welcome to JS world");

</script>

</body>

</html>

Example program

13 of 13

THANK YOU