User Tools

Site Tools


eg-259:lecture9

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
eg-259:lecture9 [2013/02/20 16:57] – [DOM 2 Example] eechriseg-259:lecture9 [2013/02/26 08:33] (current) – [Previous Example] eechris
Line 58: Line 58:
   * What purpose does the //navigator// object have?    * What purpose does the //navigator// object have? 
  
 +===== Previous Example =====
  
 +Used HTML event attributes
 +  * [[http://localhost:4567/eg-259/examples/lecture8/radio_click.html|radio_click.html]]
 +  * [[http://jsfiddle.net/cpjobling/9HVQk/4/|jsFiddle]] (http://jsfiddle.net/cpjobling/9HVQk/4/)
  
 ===== Handling Events from Button Elements (more) ===== ===== Handling Events from Button Elements (more) =====
Line 677: Line 681:
 ===== DOM 2 Example ===== ===== DOM 2 Example =====
  
-  * A revision of //validator//, using the DOM 2 event model: [[http://localhost:4567/eg-259/examples/lecture9/validator2.html|validator2.html]]+  * A revision of //validator//, using the DOM 2 event model: [[http://localhost:4567/eg-259/examples/lecture9/validator2.html|validator2.html]]
 +  * Note that this doesn't quite do the right thing as the submit button can be pressed and invalid data can be sent to the server. 
 +  * A solution for this is left as an exercise.
  
 ---- ----
Line 761: Line 767:
     * The ''appName'' property has the browser’s name      * The ''appName'' property has the browser’s name 
     * The ''appVersion'' property has the version number      * The ''appVersion'' property has the version number 
-  * Example: [[/eg-259/examples/lecture9/navigate.html|navigate.html]]+  * Example: [[http://localhost:4567/eg-259/examples/lecture9/navigate.html|navigate.html]]
  
 ---- ----
Line 772: Line 778:
  
   * Code:    * Code: 
-<source http://eng-hope.swan.ac.uk/eg-259/examples/lecture9/navigate.html javascript|navigate.html>+<code html> 
 +<!DOCTYPE html> 
 +<!-- navigate.html 
 +An example of using the navigator object 
 +--> 
 +<html lang="en"> 
 +  <head> 
 +    <meta charset="utf-8" /
 +    <title> Using navigator </title> 
 +    <script> 
 +      // The event handler function to display the browser name 
 +      //  and its version number 
 + 
 +      function navProperties() { 
 +        alert("The browser is: " + navigator.appName + "\n" +  
 +              "The version number is: " + navigator.appVersion + "\n"); 
 +      } 
 +    </script> 
 +  </head> 
 +  <body onload = "navProperties()"></body> 
 +</html
 +</code>
  
 ===== Summary of This Lecture ===== ===== Summary of This Lecture =====
eg-259/lecture9.1361379421.txt.gz · Last modified: 2013/02/20 16:57 by eechris