In this activity, you'll be given some sample code that generates
"Mad Libs", are word games popular with the 9-12 year old set. Adults can enjoy them too if they allow themselves to be silly enough.
In this lab, you'll be given some source code for a Mad Lib from a textbook I'm evaluating for future use in CISC103. You'll then be asked to create you own Mad Lib web page following the model.
By the time you complete this activity, you should know how to do the following in JavaScript:
You should also know how to put JavaScript into an XHTML file that will pass validation at validator.w3.org.
Look at the page: http://copland.udel.edu/~pconrad/cisc103/05F/activities/activity06/
Try making a Mad Lib from this page. Also do a "view source" and read through and try to understand the XHTML and JavaScript source.
Using the sample template from the 10.20 lecture, make this page validate. "Tentative" validation based on implied UTF-8 encoding is good enough; you may need to leave out the <?xml version="1.0" encoding="UTF-8"?>
declaration if you want the page to work in Internet Explorer.
Hints:
<input type = "checkbox" name = "chkEvil" value = "evil" />
or by putting </input>
after it. Make this page appear at the link:
http://copland.udel.edu/~userid/cisc103/activity06/ml.html
You know what to do by now (if not, consult previous activities).
Now write a page similar to ml.html that creates your own mad lib. It should have at least as many entries for customized text, and be at least about the same length. You may want to adjust the attributes of the textarea element if needed to make more room for your story.
Now, to submit the file, use the same process you used in step 2 to upload this file to the following URL:
http://copland.udel.edu/~userid/cisc103/activity06/ml2.html
This activity counts as a regular lab grade out of 100 pts, broken down as follows:
20 pts | Validation | Validate ml.html and ml2.html against validator.w3.org. There should be no XHTML errors (10 points each) |
30 pts | Style | XHTML and JavaScript code should be clean and neat, with tags aligned and indented properly to make the code readable. JavaScript code should contain comments to explain what is happening in the code (15 points each) |
40 pts | Correctness | The web page should behave as described in the assignment description (20 points each) |
10 pts | Following directions | The web page should be submitted according to the directions in the assignment. |
Mad Lib code is Copyright 2001 by Prima Publishing, from JavaScript Programming for the Absolute Beginner, by Andy Harris. ISBN 0-7615-3410-5
Copyright 2005, Phillip T. Conrad, CIS Dept., University of Delaware. Permission to copy for non-commercial, non-profit, educational purposes granted, provided appropriate credit is given; all other rights reserved.