Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

JavaScript

JavaScript is a widely used scripting language developed by Netscape, primarily for web development and data validation. It supports both client-side and server-side scripting, allowing for the creation of interactive web pages and includes features such as objects, methods, events, and dialog boxes. JavaScript utilizes control statements for program flow, including conditional and loop constructs, and supports various data types and arrays.

Uploaded by

kcandtc1986
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

JavaScript

JavaScript is a widely used scripting language developed by Netscape, primarily for web development and data validation. It supports both client-side and server-side scripting, allowing for the creation of interactive web pages and includes features such as objects, methods, events, and dialog boxes. JavaScript utilizes control statements for program flow, including conditional and loop constructs, and supports various data types and arrays.

Uploaded by

kcandtc1986
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

J AVA SCRIPT

Scripting language in content development (web development) supports all


facilities of data validation. Example of scripting language is java script and VB
Script.
Java Script is a scripting language created by Netscape is most widely used.
Netscape developed JavaScript. The Vbscript is also scripting
language developed by Microsoft Corporation. Vbscript support only by
Microsoft Internet Explorer. But Netscape as well as Internet explorer supports
java script.
JavaScript has two different versions. They are Live wire, which permit the
server side JavaScript code to connect to the relational database.
The next one is the client side JavaScript, which is used at client side,
traditionally embedded into a standard HTML program. The extension name of
an exclusive JavaScript program is .JS. If we embed a java script code into
HTML document then the extension name would be .html or .htm
JavaScript is a scripting language for validation of user inputs in a Web
page. Java script fits into an HTML program. JavaScript programs thus require
a browser to be run. Java script is a interpreter based language ie., the source
coded is always translated to a machine language that the computer understands
when gets executed. JavaScript is embedded in html files; hence not require any
extra editor for programs to be written. JavaScript is an object-oriented
language that allows creation of interactive Web pages. Java script has
procedural capabilities. That means like other programming languages it has
conditional structures, since JavaScript is object oriented it supports event
programming.

OBJECT IN JAVASCRIPT
JavaScript is an object based Language. It treats each of the elements of web
page as an object. They are grouped according to their type and purpose.
Document: corresponds to the current web page’s body. Using this we can have
access to the html of the page it self, including all the links, images and anchors.
Form: holds information about html forms in the current page; forms can
contain buttons, text fields and all kinds of other html elements.
Frame: refers to the frame in browser window.
History: holds the record of the sites the web browser has visited before
reaching the current page. Gives you access to methods that let you move to
previous pages.
Location: holds information about the location of the current web page, such as
its URL, the domain name, path, server port and more.
Navigator: refers to the browser itself, letting you determine what browser the
user has.
Window: refers the current browser window.
Properties:
An object has its own characteristic that makes it unique within a group. Some
characteristic or properties are common to many objects while other are
specified to each one.
The Syntax for properties is:
Object. properties
Document.bgcolor
Method:
Most objects have special function called methods that executes some operation
related to the object. The basic syntax is:
Object. Method (arguments)
Events:
An event determines the object reaction to external condition. They are
recognized by object and handled application. An event occur through user
action such as Mouse Click on Button or entering the content of a field
Function:
Functions are predefined routines built for a specific task. They are different
from methods, as they are not associated with an object. JavaScript has generic
function for various tasks.
Operator:
The Symbol that is used to represent a particular operation on some operands is
called operator.
The Script Tag:
The browser is give the information about an embedded JavaScript into an
HTML file using the HTML tag pair <script></script>
It has only one attributes that is LANGUAGE; each indicates which scripting
language is used.
Syntax:
<Script language=”JavaScript”>
java script code
</script>
Variable:
A variable is a placeholder we can store our data and information. it is a name
of location of memory when the constant is stored. JavaScript allow you to
declare a variable and use the value stored in them. In JavaScript we can declare
a variable using the VAR keyword.
Ex:
Var name;
Var mark;
Var age;
Var adr

Data types and literals:


JavaScript supports primitive types of values and support complex types such as
array and objects. The data types are Number, Boolean, String, and Null
To create variable only the keyword var is used.
Ex:
Var name=”Abhilash”
Var roll=1
Var course=”PGDCA”
Dialog Boxes:
JavaScript also provides the various dialog boxes to display alert messages
and to take user input. These dialog boxes appear as separate windows and the
content of these windows are independent of the text in the html page. The
content of these dialog boxes are taken from user input.
There are three types of dialog boxes provided by JavaScript:
1.Alert box:
This dialog box is used to alert the user. It means to provide small amount
of text to the user alert box is used.
Syntax: alert (“message”)
Example: alert (“welcome to essential JavaScript”)
2.prompt dialog box:
is used for interaction with users. The prompt () method instantiates the
prompt dialog box which displays a specified message. It provides a single data
entry field.
Syntax : prompt(“message”,”default value”)
Example: prompt(enter your name”,”name”)
3. confirm dialog box: this is the third dialog box, serves as a technique for
confirming user action

Programming Construct:
The control statement enables us to specify the order in which the various
instructions in a program are o. In other word the control statement determine
the flow of control in a program. In JavaScript control statement are of two
types:
1. Conditional Control Statement
2. Loop Control Statement
Conditional Control Statement:
The construct provides facility to execute a person of program only once
based on a condition. The conditional constructors are:
1. if …… Else
2. Switch Case

If……………Else:
The primary decision making construct of any programming language is IF.
This construct allow for the conditional branching of the code.

Syntax:
If (condition)
{
Statement;
Statement;
}
Else
{
Statement
Statement
}
Switch Case:
This control statement allows us to make a decision from number of choice.
This is basically use to replace multiple if function
Syntax:
Switch (condition)
{
Case “constant” or int const:
{
Statement for case 1;
Break;
}
Case “constant” or int const:
{
Statement for case 2;
Break;
}
Case “constant” or int “const”:
{
Statement for case 3;
Break;
}
………..
………..
………..
Default:
{
Statement for default;
}
}
Loop Construct:
Loop construct is the ability to perform set of instruction repeatedly. This
involve repetinting some person of program either a specific number of time or
until a particular condition is satisfied. This repetitive done through a loop
control statement. There are twi type of loop in JavaScript.
1. For Loop
2. while Loop
For Loop:
For is a loop statement where a statement can be executed as per the
condition and it could not terminated till the condition become satisfied.
Syntax:
For(initialize counter; condition check; increment or decrement counter)
ARRAY:
Array are order collection of a value refer by a single variable name.
Ex:
Num [5]

Num [0]=Jitesh
Num [1]=chandan
Num [2]=Jitesh
Num [3]=sanjay
Num [4]=bikash

You might also like