Dynamic Javascript, Timers, XML




CS174

Chris Pollett

Nov 9, 2016

Outline

The Document, Window and Navigator Object

Element Positioning

Moving Elements

Element Visibility, Colors and Fonts

Dynamic Content

Timers

Let's Build Something

Create a small HTML page with an h1 header that says: "Enter Email For Grand Prize Drawing". Beneath this it has a text field with label Email and an Enter button. In a div field below there is a count down clock that is updated every five seconds. Initially, it says, "30 Seconds Left!" If the Enter button is clicked before the 30 seconds is up and the Email field is not empty, the div field says, "You won the grand prize!" If the Enter button is clicked but no data is in the name field, an alert appears saying, "Please Enter Your Email". Finally, if the 30 seconds expires, the div field is replaced with "You missed the drawing!"

Post your code to the Nov 9 Discussion Thread.

Introduction to XML

The Syntax of XML

XML Document Structure and Entities

Document Type Definitions

<!ELEMENT ..>

<!ATTLIST ..>

<!ENTITY ..>

Example DTD

<?xml version = "1.0" encoding ="utf-8" ?>
<!-- planes_for_sale.dtd  -->
<!ELEMENT planes_for_sale (ad+) >
<!ELEMENT ad (year, make, model, color, price?, seller) >
<!ELEMENT year (#PCDATA)>
<!ELEMENT make (#PCDATA)>
<!ELEMENT model (#PCDATA)>
<!ELEMENT color (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT seller (#PCDATA)>
<!ATTLIST seller license CDATA #REQUIRED >
<!ENTITY c "cessna" >

Internal versus External DTDs