March 20, 2007
Harvard University
Division of Continuing Education
Extension School
Course Web Site: http://cscie12.dce.harvard.edu/
Copyright 1998-2007 David P. Heitmeyer
Instructor email:
david_heitmeyer@harvard.edu
Course staff email:
cscie12@fas.harvard.edu
Add your location to the map. All information is optional, and is restricted to class members. This is an illustration of using the power of Google Maps API. Provide your location in the next week (Tue March 27), and you will earn 10 points towards your 'participation' grade.
Bringing together data from different sources and presenting them in novel ways
Intuitive, responsive, fast, "desktop-like" Web-based applications
Client-side scripting language
Let's take a look at checking form input with JavaScript, Example:
The important pieces:
<script>
element
<!ELEMENT script - - %Script; -- script statements --> <!ATTLIST script charset %Charset; #IMPLIED -- char encoding of linked resource -- type %ContentType; #REQUIRED -- content type of script language -- src %URI; #IMPLIED -- URI for an external script -- defer (defer) #IMPLIED -- UA may defer execution of script -- >
<script> element typically goes in head, but can be a child of body and many other elements.script element should not be empty, but should include a space, a comment, or even a simple return true; statement.Two javascript statements:
document.SimpleCalc1.circumference.value=CalcCircumference(document.SimpleCalc1.radius.value)
document.SimpleCalc1.area.value=CalcArea(document.SimpleCalc1.radius.value
window.location = menu.options[menu.selectedIndex].value;
menu.options[]
menu.selectedIndex
.value
window.location
Validate form input using the onsubmit event handler.
Validate form fields with Regular Expressions
Regular Expression:
/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/
Tutorials
Libraries and Examples
Body onload and focus on a form input.
Use of :focus pseudo-class to style those input boxes with focus.
Buzzword or something "real"?
What Is Web 2.0: Design Patterns and Business Models for the Next Generation of Software by Tim O'Reilly
Principles, Characteristics, Features:
Web 2.0 Meme Map by Tim O'Reilly
Visualizing Web 2.0 by Dion Hinchcliffe
Visualizing Web 2.0, Peter, blog.forret.com
"Weaving the Web" by Tim Berners-Lee, ISBN: 006251587X
Link to this book in WorldCat is simply:
http://worldcat.org/isbn/006251587X
Amazon.com offers several different web services, including one for e-commerce.
Rich Internet Applications, Rich User Experience
W3C XML DOM allows the all aspects of the document to be accessed and manipulated.
getElementById is a frequently seen method
Once we have the node selected, we can manipulate its properties. In this case, we are changing the "visibility" to "visible" or "hidden".
Block whose visibility is set can be positioned absolutely.
We can show, hide, and change the style properties via Javascript
Tables are constructed with thead and tbody. Simply by giving them a class="sortable",
the jQuery Tablesorter Plugin makes them 'sortable' and 'striped':
Senate data comes from GovTrack.US. Table sorting is achieved through jQuery and the jQuery Tablesorter Plugin
Tables are constructed with thead and tbody. Simply by giving them a class="sortable",
the jQuery Tablesorter Plugin makes them 'sortable' and 'striped':
The JavaScript and CSS:
Senate data comes from GovTrack.US. Table sorting is achieved through jQuery and the jQuery Tablesorter Plugin
Using the dp.SyntaxHighlighter, plain textarea elements
can be transformed into highlighted code.
What is needed:
textarea
name="code" attribute with any textarea that should be processedclass attribute to control the syntax highlighting applied (e.g. xml, js, css, java)And here is the same code, without the SyntaxHighlighter invoked:
Asynchronous JavaScript and XML
AJAX: A New Approach to Web Applications, from Adaptive Path.
by Jesse James Garrett
Place "markers" and information on maps via XML data.
Javascript createMarker function:
Prototype is a JavaScript/AJAX library that greatly simplifies creating and using AJAX.
There is a URL that returns a list of courses given a course group (as an XHTML snippet):
What's involved:
courselist_partial which take a course_group query parameter)getCourseList) to call server-side processgetCourseList function.Javascript:
Invoking the Javascript:
There is a URL that returns a list of course titles given a string (as an XHTML list):
Tab Plugin for jQuery allows the easy creation of tabs.
Exhibit is a lightweight structured data publishing framework that lets you create web pages with support for sorting, filtering, and rich visualizations by writing only HTML and optionally some CSS and Javascript code.
Collected website information from over 250 colleges (list from US News & World Report).
For each school, collect the following information:
| URL | http://www.washington.edu/ |
|---|---|
| Title | University of Washington |
| Valid | valid |
| Errors | 0 |
| Doctype | -//W3C//DTD XHTML 1.0 Strict//EN |
| encoding | iso-8859-1 |
| error string | 0 error |
| URL_end | http://www.washington.edu/ |
| thumshot_url | http://open.thumbshots.org/image.pxf?url=http://www.washington.edu/ |
This was accomplished through the wonders of Perl and the xml output of the W3C Markup Validator
output=xml in query stringNote too that we are using Open Thumbshots, which allows us to grab a 120x90 pixel image of a URL.
Convert the data to "JSON" format (JSON is Javascript Object Notation).
One entry looks like:
The entire data file: colleges.json
Steps required:
Template that defines a view:
Senate data comes from GovTrack.US.