定义 | A scripting language used for client-side web development. |
作用 | an implementation of the ECMAScript standard defines the syntax/characteristics of the language and a basic set of commonly used objects such as Number, Date supported in browsers supports additional objects(Window, Frame, Form, DOM object) |
One Java Script? |
Different brands and/or different versions of browsers may support different implementations of JavaScript. – They are not fully compatible. – JScript is the Microsoft version of JavaScript. |
Create an interactive user interface in a webpage (eg. menu, pop-up alerts, windows) |
Manipulate web content dynamically – Change the content and style of an element – Replace images on a page without page reload – Hide/Show contents |
Generate HTML contents on the fly |
Form validation |
Validation | Validating forms before sending to server. |
Dynamic writing | Client-side language to manipulate all areas of the browser’s display, whereas servlets and PHPs run on server side. |
Dynamic typing | Interpreted language (interpreter in browser): dynamic typing. |
Event-handling | Event‐Driven Programming Model: event handlers. |
Scope and Functions | Heavyweight regular expression capability |
Arrays and Objects | Functional object‐oriented language with prototypical inheritance (class free), which includes concepts of objects, arrays, prototypes |
Commands are interpreted where they are found |
– start with tag, then functions in or in separate .js file |
– static JavaScript is run before is loaded | |
– output placed in HTML page • [document.write() ... dynamic scripting] • |