JavaScript1.ppt - JavaScript 1 Introduction and DOM Kevin McManus JavaScript 1 What is JavaScript \u2022 A scripting language developed in a collaboration

JavaScript1.ppt - JavaScript 1 Introduction and DOM Kevin...

This preview shows page 1 - 9 out of 50 pages.

JavaScript 1 Introduction and DOM Kevin McManus
Image of page 1
© 2007 the University of Greenwich 2 JavaScript 1 What is JavaScript? A scripting language developed in a collaboration between Netscape and Sun Microsystems to provide client-side programming in web pages Introduced by Netscape in 1995 Executable JavaScript may be included into an HTML page as either... external a separate file containing JavaScript embedded as the content of a <script> element inline as the value of an HTML event attribute
Image of page 2
© 2007 the University of Greenwich 3 JavaScript 1 What is JavaScript? Not a full programming language like Java or C++ core language has no graphics, no file handling, no networking Not a subset of Java - syntactically similar but: loose data typing object based not strictly object oriented although inheritance is possible Not simple - easy to get started but large and complex client-side code is interpreted by the browser it’s scope is restricted to the browser cannot carry a malicious payload
Image of page 3
© 2007 the University of Greenwich 4 JavaScript 1 Versions of JavaScript Originally introduced in Netscape Navigator 2.0 and Internet Explorer 3.0 Very widely used on the web but for "serious applications" held back by: incompatibilities between browsers security issues lack of a good IDE perception of it as a "toy" language these problems are now reducing Exists as: core language client-side version (with client side objects) server-side version (with server side objects) Latest version is 1.5 Microsoft's version is officially called JScript standard version of the core language is called ECMAScript European Computer Manufacturers Association JavaScript 1.3 is reported to be ECMA-262 compatible
Image of page 4
© 2007 the University of Greenwich 5 JavaScript 1 Typical Uses GUI enhancement rollovers images pull-down menus browser sniffing to adjust page layout Techniques to reduce the load on the server validating input before sending to a server-side program shopping carts Mini-applications calculators, calendars Animation Asynchronous applications AJAX Many of the above require DHTML Dynamic HyperText Markup Language combination of JavaScript & HTML & CSS & DOM
Image of page 5
© 2007 the University of Greenwich 6 JavaScript 1 Discussion questions Why might it be a good idea to use JavaScript to offload work from the server to the client machine? What IPR (intellectual property rights) issues might be associated with use of JavaScript? Under what circumstance might browser compatibility issues not be a problem for a JavaScript developer? Can you think of at least two different strategies for dealing with browser compatibility problems.
Image of page 6
© 2007 the University of Greenwich 7 JavaScript 1 First example embedding JavaScript in HTML embed.html var age = parseInt(prompt( "Please enter your age" , 29));
Image of page 7
© 2007 the University of Greenwich 8 JavaScript 1 First example embedding JavaScript in HTML embed.html alert( "You look younger than " + age)
Image of page 8
Image of page 9

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture