tailieunhanh - ICT 5 Web Development - Chapter 13: Javascript
ICT 5 Web Development - Chapter 13: Javascript presents JavaScript Overview Window Controls & Event Handlers, DOM & Cookies, AJAX Overview, AJAX Implementation, What is JavascriptJavascript, JS syntax basic. | Vietnam and Japan Joint ICT HRD Program Content 1. 2. 3. 4. 5. ICT 5 - Web Development Chapter 13. Javascript JavaScript Overview Window Controls & Event Handlers DOM & Cookies AJAX Overview AJAX Implementation Nguyen Thi Thu Trang trangntt@ . What is Javascript (JS)? . What is Javascript (2)? More than form validation Client-Side S i ti Client Cli t-Sid Scripting L Language Originally to be called LiveScript – Developed by Netscape Relationship to Java? – Dynamic – Weakly Typed – Object-Oriented (Prototype-Based) Object(Prototype- – Not directly, but Shares syntax, keywords Named to take advantage of Java mania Interpreted Variants – Microsoft developed its own JScript (mostly the same) – A common subset of both is standardized as ECMAscript 3 1 JavaScript vs. Java What is JS used for today? JavaScript Handling User Interaction – Cannot draw, multi-thread network or do I/O draw multi-thread, Java – Cannot interact with browser or control content JavaScript is becoming what Java was originally intended to be – Java applets: lightweight d J l t li ht i ht downloadable l d bl programs run within the browser for crosscrossplatform compatibility – JS: lightweight and accomplish most of what applets do with a fraction of the resources – Checking for accuracy and appropriateness of data entry from forms – Doing small calculations/manipulations of forms input data – Search a small database embedded in the downloaded page – Save data as cookie Generating Dynamic HTML documents Examples: – Bookmarklets, Google Maps, Google Suggest Bookmarklets, 5 . JS syntax basic 6 a. JS Variables and Literals Variable declaration Dynamic Typing - Variables can hold any valid type of value: – Explicit: var i = 12; // no ‘var’ in declaration ‘var’ – Implicit: i = 12; – Number var myInt = 7; – Boolean var myBool = true; – Array var myArr = new Array(); – String var myString = “abc”; “abc”; – and can hold values of different
đang nạp các trang xem trước