Assignment – Create Assignment Page
- Download the HTML Site Template
- Review the HTML5 Template (you will be copying this as your page template for every assignment)
- A scripting language (interpreted not compiled–though there are ways of compiling it, see Google V8)
- Almost a full object oriented programming language.
- A client side language, running in the web browser (though there are ways to run it server-side)
- BOM – Browser Object Model
- DOM – Document Object Model
- Events – Events such as clicking of mice and pressing on keys
- Until recently was considered to be a toy language
- Browser Pong
// single line comment
/* block of commented text spanning multiple lines */
Paste the following into the address bar of your browser:
<body onload="alert( 'This page has finished loading.' );">
<a onclick="alert( 'You clicked me!' );">
When the user clicks the anchor tag, it fires the onclick event.
<div onmouseover="alert( 'You hovered!' );"></div>
When the user hovers over the div, the onmouseover event is triggered.
For example, the modification date and time for an HTML file could be written into the body by placing the following just before your closing body tag:
However, if you place this in the head element of you page, it will output in the head element where it won’t be rendered to the visible portion of the page. This is one reason why document.write is a problematic method.
These files, just like externally linked css files, can be referenced in the following ways:
- Absolute reference: “http://ipirates.net/js/jsfile.js”
- Relative reference (to the html document loading it): “js/jsfile.js”
- Absolute Site Path: “/js/jsfile.js” (the initial / means it will look at the root of the web url)
- Absolute reference to an external server: “http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”