eg-259:lecture5
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
eg-259:lecture5 [2013/02/11 12:42] – eechris | eg-259:lecture5 [2013/02/12 08:27] (current) – [Screen Output: jQuery magic] eechris | ||
---|---|---|---|
Line 169: | Line 169: | ||
Although JavaScript looks like it should be a win-win for both developers and users, this is not always the case: | Although JavaScript looks like it should be a win-win for both developers and users, this is not always the case: | ||
- | * Most scripts rely upon manipulating elements of the DOM. Support for a standard set of DOM objects currently does not exist((Although the situtaion is much better now as HTML5 is more prescriptive about what the DOM should be and what browsers should do in given situations.))and access to objects differs from Browser to Browser. | + | * Most scripts rely upon manipulating elements of the DOM. Support for a standard set of DOM objects currently does not exist((Although the situtaion is much better now as HTML5 is more prescriptive about what the DOM should be and what browsers should do in given situations.)) and access to objects differs from Browser to Browser. |
* If your script does not work then your web page is useless! | * If your script does not work then your web page is useless! | ||
* Because of the problems of broken scripts, many Web surfers disable JavaScript support in their browser. | * Because of the problems of broken scripts, many Web surfers disable JavaScript support in their browser. | ||
* Scripts can run slowly and complex scripts take a long time to start up((Again modern browser developers have put a lot of effort into making script engines more efficient. Conversely, web applications rely more and more on scripts, so this speed advantage may not last long)). | * Scripts can run slowly and complex scripts take a long time to start up((Again modern browser developers have put a lot of effort into making script engines more efficient. Conversely, web applications rely more and more on scripts, so this speed advantage may not last long)). | ||
+ | * To overcome browser issues, modern developers make use of libraries that provide better abstractions of the DOM and allow separation of concerns between the application data and the display of that data in HTML((Two popular libraries are jQuery and BackboneJS.)) | ||
Line 266: | Line 267: | ||
===== The Script Itself ===== | ===== The Script Itself ===== | ||
- | The script itself defines the two functions '' | + | The script itself defines the two functions '' |
Line 461: | Line 462: | ||
===== More on Variables and Operators ===== | ===== More on Variables and Operators ===== | ||
- | Visit the OpenJS tutorial for an interactive presentation. | + | Visit [[http:// |
- | + | ||
- | * [[http:// | + | |
- | * [[http:// | + | |
- | + | ||
- | For even more details see [[http:// | + | |
Line 568: | Line 564: | ||
---- | ---- | ||
- | In Firebug | + | In Firefox and Chrome developer tools there is a JavaScript console. You can write to it using: |
<code javascript> | <code javascript> | ||
console.log(" | console.log(" | ||
</ | </ | ||
- | does almost the same thing as '' | + | It's better than '' |
+ | ===== Screen Output: jQuery magic ===== | ||
+ | * HTML placeholder | ||
+ | <code html> | ||
+ | <div id=" | ||
+ | </ | ||
+ | </ | ||
+ | * Output function | ||
+ | <code javascript> | ||
+ | $('# | ||
+ | </ | ||
+ | * Result | ||
+ | <code html> | ||
+ | <div id=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
===== Screen Output: alert ===== | ===== Screen Output: alert ===== | ||
eg-259/lecture5.txt · Last modified: 2013/02/12 08:27 by eechris