JavaScript Tabriz university 2009
Its September 1995
Netscape Version 2.0 of browser is released.
Its first version to come with the scripting language.
the name of the language was first Mocha and then, when released, LiveScript
In December of that year Netscape made a marketing deal with Sun and renamed the language to
What is JavaScript?
JavaScript is a client-side scripting language. If the browser supports the language, JavaScript grants access to the current page and lets the script determine properties of the client, redirect the user to another page, access cookies, and do much more.
Microsoft included JavaScript support from Internet Explorer version 3 onward (mid-1996).
For legal reasons the language was called JScript.
Microsoft started to include additional, IE-only features to JScript.
In 1997, the standard ECMAScript (ECMA-262) was published; JavaScript is therefore the first implementation of that standard. ECMAScript became an ISO norm in ECMA: European Computer Manufacturers Association
Around 1997 or 1998, the browser war between Netscape and Microsoft reached a climax, with both vendors adding new, incompatible functionality to version 5 of their browsers.
Vs
Netscape scrapped the idea of releasing browser version 5 and decided to start all over with Netscape 6, which helped Internet Explorer to expand its market share to over 90%.
It took the then-founded Mozilla project several years to come to life again. The very popular Firefox browser was based on Mozilla and started to take market share away from Microsoft.
Other browsers, by the way, support JavaScript as well. Differences are subtle, but still can be extremely annoying when one is developing a browser-agnostic web application.
Internet Explorer
Mozilla Firefox Epiphany Camino Galeon
Opera
Konqueror
Safari
Java Vs JavaScript
Java 1991 Sun Microsystems. Called Oak Called Java.
Java A simple, secure, portable, object oriented, robust, multi-threaded, architecture-neutral, interpreted, high performance, distributed and dynamic programming language.
Java Vs JavaScript JavaScript was developed by Netscape Java was developed by Sun
Java Vs JavaScript JavaScript – Cannot draw, multi-thread, network or do I/O Java – Cannot interact with Browser or control content
Java Vs JavaScript JavaScript – Cannot draw, multi-thread, network or do I/O Java – Cannot interact with Browser or control content
JavaScript We’ll call collections of JavaScript code scripts, not programs JavaScript and Java are only related through syntax JavaScript’s support for objects is very different
Object Orientation and JavaScript JavaScript is NOT an object oriented programming language: – Does not support class based inheritance – Cannot support polymorphism
Object Orientation and JavaScript JavaScript objects are collections of properties, which are like the members of classes in Java and C++
What is it used for today? Handling User Interaction: – Checking for accuracy and appropriateness of data entry from forms – Doing small calculations/manipulations of forms input data – Save data as cookie so it is there upon visiting the page Reduce web server processing load Reduce delay when users’ input is wrong
Generating Dynamic HTML documents Controlling applets and calling Java from JavaScript Accessing JavaScript from Java Allow further capabilities together with other technologies: – DHTML ( Dynamic HTML) – AJAX (Asynchronous JavaScript and XML)
Language Basics
JavaScript in HTML directly, as in JavaScript script – Or indirectly, as a file specified in the src attribute of, as in <script type = "text/javaScript" src = "myScript.js">
Example <!-- // this is a comment document.write(“Hello World!!”) ; alert(“Done!”) // -->
Syntax Variables Functions Objects … Syntax based on C/C++/Java Case Sensitive
I need JS code WRITE STEAL
References: JavaScript™ Phrasebook: Essential Code and Commands – By Christian Wenz – Sams