Dynamic Javascript, Timers, XML




CS174

Chris Pollett

Apr 19, 2017

Outline

Dynamic Content

Timers

In-Class Exercise

Create a small HTML page with an h1 header that says: "We'll Send You Money!!". 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 three seconds. Initially, it says, "15 Seconds Left!" If the Enter button is clicked before the 15 seconds is up and the Email field is not empty, the div field says, "You won!" 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 15 seconds expires, the div field is replaced with "You missed getting money!"

Post your code to the Apr 19 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

Namespaces

XML and CSS