Advanced JavaScript
JavaScript
is interpreted scripting language
JavaScript
was initially created to “make WebPages alive”
Features of JavaScript
1)
JavaScript is
lightweight scripting language because it does not support all features of
object oriented programming languages.
2)
No need of special software
to run JavaScript programs.
3)
It is case sensitive.
4)
Perform input
validations.
5)
Handle date and time
operations.
6)
JavaScript is platform
independent scripting language.
7)
JavaScript is universal
client scripting language.
Types of scripting
1) Client side scripting- Script resides on client computer and
that run on the client.
2) Server side scripting- Script resides on web server and
activated by client then it is executed on web server.
Statements.
1)Switch case- Built in multiway decision
statement.
2) for . . . . loop-This loops executes
statements as long as condition becomes true, control comes out from loop when
condition becomes false.
3)While….loop – This loop executes statements as
long as condition is true.
4) Break- This stamen is used to jump out of loop.
It is used to make an early exit from a loop.
5)Continue- This statement is used in looping
when may be to skip some statement block
and take control at the beginning for next iteration.
Objects in JavaScript-
JavaScript is an object oriented scripting
language.
A JavaScript object is an entity having state
(properties) and behavior(methods)
JavaScript supports two types of object.
1)Built-in-object –such as
math,string,array,date etc.
2)User defined object- create user Defined
objects as per requirement.
The
‘new’ keyword is used to create object in JavaScript.
DOM-Document object model
When HTML documents is loaded into a web browser
it becomes a document object.DOM defines logical structure of document.
W3C- Word wide web consortium.
The standardizations of Dom was founded by W3C.
“The W3C Document object model is a platform and
language natural interface that allows programs and scripts to dynamically
access and update the content ,structure ,and style of a document.
DOM Object Properties and methods.
Property
1)head – returns the <head> element of the
document.
2) title- sets or return title of the document.
3) URL- returns full URL of the HTML document.
4) body,img- returns <body>,<img>
elements
Methods-
1)write()- Writes HTM L expressions or JavaScript
code to a document.
2) wrieln()-Writes HTM L expressions or JavaScript
code to a document and newline character after each statements
3) getElemetById()-used to fine and element.
The innerHTML Property-
Useful for
getting html element and changing its content.
Window Object-
Window
object is the very top object in object hierarchy.
Window object is the parent object of all other
object.
It represents an open window in a browser.
An object of window object is created
automatically by the browser.
Property-
1) Name- sets or return the name of a window.
2) Location-Returns the location objet for the window.
3) Document-returns the document object for the window.
4) Status- sets or return the text in the status bar of a
window.
5) Closed- returns Boolean value indicating whether a window
has been closed or not.
No comments:
Post a Comment