Page 138 - DCAP408_WEB_PROGRAMMING
P. 138
Web Programming
Notes 5.13 Review Questions
5.14 Further Readings
Objectives
After studying this unit, you will be able to:
Explain the Java Script programming
Scan the data types
Describe Variables
Demonstrate Arrays and Operators
Recognize Loops and Functions
Explain Dialog Boxes and String Manipulation Function
Scan the use of timer in web pages
Discuss setting and getting date in a web page
Introduction
Java script is a browser-interpreted language that was created to access all elements of HTML
and the browser. The processing is done entirely by the client-side browser which makes it very
useful tool to handle processing which would have otherwise been checked server-side, thereby
reducing overhead. Java script is also used to increase user interaction, animate objects, create
drop down navigation, grab data from databases, and more!
JavaScript is most commonly used as a client side scripting language. This means that JavaScript
code is written into an HTML page. When a user requests an HTML page with JavaScript in it, the
script is sent to the browser and it’s up to the browser to do something with it. The fact that the
script is in the HTML page means that your scripts can be seen and copied by whoever views
your page. Nonetheless, to my mind this openness is a great advantage, because the flip side is
that you can view, study and use any JavaScript you encounter on the WWW.
JavaScript can be used in other contexts than a Web browser. Netscape created server-side
JavaScript as a CGI-language that can do roughly the same as Perl or ASP.
JavaScript is not a programming language in strict sense. Instead, it is a scripting language
because it uses the browser to do the dirty work. If you command an image to be replaced by
another one, JavaScript tells the browser to go do it. Because the browser actually does the work,
you only need to pull some strings by writing some relatively easy lines of code. That’s what
makes JavaScript an easy language to start with.
But don’t be fooled by some beginner’s luck: JavaScript can be pretty difficult, too. First of all,
despite its simple appearance it is a full fledged programming language: it is possible to write
quite complex programs in JavaScript. This is rarely necessary when dealing with web pages,
but it is possible. This means that there are some complex programming structures that you’ll
only understand after protracted studies.
Secondly, and more importantly, there are the browser differences. Though modern web browsers
all support JavaScript, there is no sacred law that says they should support exactly the same
JavaScript. A large part of this site is devoted to exploring and explaining these browser differences
and finding ways to cope with them.
132 LOVELY PROFESSIONAL UNIVERSITY