Page 71 - DCAP202_Fundamentals of Web Programming
P. 71

Fundamentals of Web Programming




                    Notes          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.
                                   So basic JavaScript is easy to learn, but when you start writing advanced scripts browser differences
                                   (and occasionally syntactic problems) will creep up.
                                   6.1 Origin of JavaScript


                                   JavaScript was originally developed in Netscape, by Brendan Eich. Battling with Microsoft over
                                   the Internet, Netscape considered their client-server  solution as a distributed  OS, running a
                                   portable version of Sun Microsystems’ Java. Because Java was a competitor of C++ and aimed at
                                   professional programmers, Netscape also wanted a lightweight interpreted language that would
                                   complement Java by appealing to nonprofessional programmers, like Microsoft’s Visual Basic.
                                   Developed under the name Mocha, LiveScript was the official name for the language when it first
                                   shipped in beta releases of Netscape Navigator 2.0 in September 1995, but it was  renamed

                                   JavaScript when it was deployed in the Netscape browser version 2.0B3.
                                   The change of name from LiveScript to JavaScript roughly coincided  with Netscape  adding
                                   support for Java technology in its Netscape Navigator web browser. The final choice of name
                                   caused confusion, giving the impression that the language was a spin-off of the Java programming
                                   language, and the choice has been characterized by many as a marketing ploy by Netscape to
                                   give JavaScript the cachet of what was then the hot new web programming language.





          64                                LOVELY PROFESSIONAL UNIVERSITY
   66   67   68   69   70   71   72   73   74   75   76