Introduction to Javascript
MUST ATTEND CLASS TO OBTAIN LATEST LESSONS. OTHERWISE, YOU’RE SCREWED.
WHAT IS JAVASCRIPT (JS)
JavaScript is a scripting language that enables web developers/designers to build more functional and interactive websites.
Common uses of JavaScript include:
- Alert messages
- Popup windows
- Dynamic dropdown menus
- Form validation
- Displaying date/time
JavaScript usually runs on the client-side (the browser’s side), as opposed to server-side (on the web server). One benefit of doing this is performance. On the client side, JavaScript is loaded into the browser and can run as soon as it is called. Without running on the client side, the page would need to refresh each time you needed a script to run.
Download this powerpoint. It’s what was shown and demonstrated in class. This should give you a great foot into Javascript and then blow me away with your creativity.
| Event Handler | Application | Trigger when… |
| onAbout | Image | The loading of the image is cancelled. |
| onBlur | Button, Checkbox, FileUpload, Layer, Password, Radio, Reset, Select, Submit, Text, TextArea, Window | The object in question loses focus (e.g. by clicking outside it or pressing the TAB key) |
| onChange | FileUpload, Select, Text, TextArea | The data in the form element is changed by the user. |
| onClick | Button, Document, Checkbox, Link, Radio, Reset, Submit | The object is click on. |
| On DblClick | Document, Link | The object is double-clicked on. |
| onDragDrop | Window | An icon is dragged and dropped into the browser. |
| onError | Image, Window | A JavaScript error occurs |
| onFocus | Button, Checkbox, FileUpload, layer, Password, Radio, Reset, Select, Submit, Text, TextArea, Window | The object in question gains focus (e.g. by clicking on it pr pressing the TAB key) |
| onKeyDown | Document, Image, Link, TextArea | The user presses a key. |
| onKeypress | Document, Image, Link, TextArea | The user presses or holds down on a key. |
| onKeyUp | Document, Image, Link, TextArea | The user releases a key. |
| onLoad | Image, Window | The whole page has finished loading. |
| onMouseDown | Button, Document, Link | The user presses a mouse button. |
| onMouseMove | None | The user moves the mouse. |
| onMouseOut | Image, Link | The user moves the mouse over the object |
| onMouseUp | Button, Document, Link | The user releases a mouse button |
| onMove | Window | The user moves the browser window or frame |
| onReset | Form | The user clicks the form’s reset button |
| onResize | Window | The user resizes the browser window or frame. |
| onSelect | Text, TextArea | The user selects text within the field. |
| onSubmit | Form | The user clicks the form’s Submit button |
| onUnload | Window | The user leaves the page. |
