Week Eight (MGDP2050)
Lecture notes and exercises for Week Eight of Web Design and Development II (MGDP2050).
See also Week Seven (MGDP2050) - Week Nine (MGDP2050).
Contents
In the news
- ...
JavaScript
Recognizing JavaScript
...
Using JavaScript
JavaScript is a programming language. It is made up entirely of text.
This text is known as source code, or simply "the code".
Usually the JavaScript source code goes in one of two places:
- An external JavaScript file (affects one or more web pages)
- An individual web (affects that page only)
Script element
In your web pages, use the script element to include JavaScript.
External JavaScript file
The script element element has a src attribute, which specifies the path to the external JavaScript file.
Example:
<script src="../some-folder/example.js"></script>
Individual web page
To write JavaScript into a single web page:
- Omit the src attribute
- Use the script element as a container - JavaScript goes between the opening and closing tags.
Example:
<script> alert ('Hello world'); </script>
Fixing JavaScript
See the browser console for JavaScript error messages and other browser-related tools.
Validation
Examples
Review examples ...
jQuery
Review jQuery ...
jQuery UI
Introduce jQuery UI ...
Web applications
Discuss web applications.
Reading for next week:
- ...
Exercises: in class
...
Exercises: for next week
...