0% found this document useful (0 votes)
519 views21 pages

MCA (Web Technology)

The document discusses client-side scripting and JavaScript. It provides an overview of client-side scripting and lists some advantages and disadvantages. It then focuses on JavaScript, describing what it is, how it is used, common elements like documents and forms, and various statements and functions in JavaScript like if/else statements, for loops, and named vs anonymous functions. The document serves as an introduction to client-side scripting and core JavaScript concepts.

Uploaded by

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

MCA (Web Technology)

The document discusses client-side scripting and JavaScript. It provides an overview of client-side scripting and lists some advantages and disadvantages. It then focuses on JavaScript, describing what it is, how it is used, common elements like documents and forms, and various statements and functions in JavaScript like if/else statements, for loops, and named vs anonymous functions. The document serves as an introduction to client-side scripting and core JavaScript concepts.

Uploaded by

Lovedeep kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

DEPARTMENT OF COMPUTER SCIENCE

TOPIC:- CLIENT SERVER SCRIPT

HARPREET KAUR
19071210
INTRODUCTION
• Client-side scripting(embedded scripts) is a code that exists inside the
clients HTML page. This code will be processed on the client machine and
the HTML page will NOT perform a post back to the web-server.
Traditionally, client-server scripting is used for page navigation, data
validation and formatting.
• WHAT IS THE BEST CLIENT SIDE SCRIPTING:-
• CSS3
• JavaScript
• jQuery
• TypeScript
• ActionScript
• AJAX
ADVANTAGES OF CLIENT SIDE SCRIPT
• Allow for more interactivity by immediately responding to
users actions.
• Executive quickly because they do not require a trip to the
server.
• May improve the usability of web sites for users whose
browsers supports scripts.
• Can give developers more control over the look and behaviour
of their web widgets.
• Are reusable and obtainable from many free resoures.
DISADVANTAGES OF CLIENT SERVER SCRIPT

• Not all browsers support scripts.


• Different browsers and browser versions support
scripts differently, thus more quality assurance
testing is required.
• It required the scripting software to be install on the
server.
• Many scripts and content management systems tools
require databases in order to store dynamic data
JAVA SCRIPT

• JavaScript was developed by Brendan Eich in 1995, which


appeared in Netscape, a popular browser of that time.
• JavaScript is a client-side as well as server side scripting
language that can be inserted into HTML pages and is
understood by the web browsers.
• JavaScript is also an Object based programming language.
WHAT ARE THE USE OF JAVASCRIPT
 JavaScript are used to create the Web pages.
 It is used when a web page is to be made dynamic and add special effects
on pages like:- rollover, roll out and many types of graphics.
DOCUMENTS OF JAVASCRIPT
• A document object represents to the HTML document that is displayed in
that window.
• The document object has various properties that refers to the other objects
which allow access to modification of document content.
ELEMENTS OF DOCUMENT IN JAVASCRIPT:-
• document. anchors.
• document. body.
• document. documentElement.
• document. embeds
• document. forms.
• document. head.
• document. images.
• document. links.
FORMS OF JAVASCRIPT
• When the page is loaded, JavaScript makes an array forms in which it puts
all the forms that are one on the page.
• Each form has another array in which JavaScript puts all the element in the
form .
THERE ARE VARIOUS ELEMENTS OF FORMS
• The first form is forms[0]
• The second form is [1]
• The another array in which JavaScript puts all the elements in the forms.
FOR OBJECT PROPERTIES:-
• Autocomplete
• Encoding
• Encrypte
• Length
• Method
• Name
PROPERTIES FORMS OF JAVASCRIPT
• AUTOCOMPLETE:- The autocomplete property sets or retrieves whether
the text field should give the user some suggestion during typing.
• ENCODING:- The inputEncoding property returns the character encoding
for the document. The character set used for rendering the document,
which may differ from the encoding specified by the page.
• LENGTH:- In JavaScript length is a string property that used to determine
the length of string because length is a property of the string object.
• NAME:-The name property sets or return the value of the name attribute
of a text field.
• METHOD:-JavaScript methods are actions that can performed on objects.
A JavaScript method is a property containing a function definition.
STATEMENTS IN JAVASCRIPT
• Statements in JavaScript are used to control its program flow.
• Unlike properties, methods and events, which are
fundamenatlly tied to the object.
• Statements are designed to work independently of any
javascript object.
• FOR EXAMPLE:-
Var x, y, z; //Statement1
x=5; //Statement 2
y=6; //Statement 3
z=x+y; //Statement4
STATEMENTS

• JavaScript currently supports the following eleven Statements:-


//Comments
• break
• Continue
• for
• for…in
• if
• If…else
• function
• new
• return
• var
• While
BRIEF STATEMENTS IN JAVASCRIPT
• BREAK:-Break statement is used with a switch statement, it break out of a
switch block. This will stop the execution of code and case testing inside the block.
For Example:-
For instance:
var n=0;
While(n<5) {
If(n==3) {
n=n+1;
}
Console.log(n);
CONTINUE AND FOR STATEMENT
• CONTINUE:-Continue statement is break one iteration
in the loop. The main difference between continue and
break, is instead “jumping out” and continue “jumps
over” at one iteration in the loop.
• FOR STATEMENT:- For Statement is used to execute the
statement again and again. For Example:-
You can read statement1 sets a variable before the
loop starts.
Statement2 defines the condition for the loop to run.
Statement3 increases a value.
FOR….IN STATEMENT
• For….In statement loops through the properties of an
object. The block of code inside the loop will be executed
once for each property. For Example:-
var person={fname:”preet”,
Lname:”Doe”, age:25};
vartext= “”;
Var x;
For(x in person) {
Text += person[x] +” “;
}
IF AND IF-ELSE STATEMENT
• If statement tells us if that condition is true it will execute a block of statement.
• For example:-
<script>
var a=20;
if(a>10) {
document.write(“value of a is greater than 10”)
<script>
IF-ELSE STATEMENT the content whether condition is true to false. FOR EXAMPLE:-
<script>
var a=20;
if(a%2==0)
Document.write(“a is even number”);
}
Else{
Document.write(“a is odd number”);
}
<script>
FUNCTION AND NEW STATEMENT
• FUNCTION STATEMENT declares a function ”saved and later use” that will be executed
later when invoked. For Example:-
function myfunction(a,b) {
return a*b;
}
• NEW STATEMENT:- The new keyword construct and return an object of a constructor
function. It performs four tasks. For Example:-
fun MyFun() {
var myvar=1;
this.x=100;
}
MyFun.prototype.y=200;
Var obj1=new MyFun();
obj.x; //100
Obj.y; //200
RETURN AND VAR STATEMENT
• RETURN STATEMENT is used in a function body, the
execution of the function is stopped. if specified, a
given value is returned to the function caller. For
Example:- the following function returns the square
o its argument, x, where x is a number.
• VAR STATEMENT uses reserved keyword var to
declare a variable. A variable must have a unique
name. For Example:-
var carName=“Volvo”;
WHILE STATEMENT IN JAVASCRIPT
• While statement creates a loop that is executed while
a specified condition is true. The loop will continue to
run as long the condition is true. For Example:-
var n=0;
var x=0;
while(n<3) {
n++
x+=n;
}
FUNCTIONS OF JAVASCRIPT
• Functions are that one of the fundamental building
blocks in JavaScript.
• It is a set of statements that performs a task or
calculates a value.
• There are three types of functions in JavaScript:-
• Named Function
• Anonymous Function
• Immediately invoked function expression.
FUNCTIONS OF JAVASCRIPT
• NAMED FUNCTION:-
A named function is a function declaration if it appears
as a statement.
• For example:- Function officer() {return rank()+ “Reginald Thistleton”;
• ANONYMOUS FUNCTION:-
Anonymous Function is a function that was
declared without any name of the identifier t refer it.
• Anonymous function not accessible after it initial creation. For example:-
Function hello(){alert(‘Hello world’);}
• IMMEDIATELY INVOKED FUNCTION:-
Immediately invoked function are
common JavaScript pattern that executes a function instantly after its
defined.
OBJECTS OF JAVASCRIPT
There are many objects of JavaScript:-
• Booleans can be objects(if defined with new keyboard)
• Numbers can be objects(if defined with the new keyboard)
• String can be objects(if defined with the new keyboard)
• Dates are always objects.
• Maths are always objects.
• Regular expressions are always objects.
• Arrays functions are always objects.
• Functions are always objects.
• Objects are always objects.

You might also like