An Abbreviated Introduction to JavaScript


Mad Libs, Continued

This is a JavaScript-based CGI script that (hopefully) builds a madlibs-type story.


First, we load the library that lets us extract fields from the query.

<script language="javascript1.1" src="../Libraries/extract.js">
</script>

Next, we have the code to print out the page.

<script language="javascript1.1">
document.writeln("<p>" + queryField("name1") + " was ");
document.writeln("one of the " + queryField("adj1") + " few selected ");
document.writeln("to take <em>Arts, Multimedia, and the Internet</em>.</p>");
document.writeln("One day, this formerly wonderful class took a serious ");
document.writeln("turn for the worse as the legendarily evil professor, ");
document.writeln(queryField("name2") + ", was asked to guest-teach.");
</script>

Source text written by Samuel A. Rebelsky.

This page may be found at http://www.math.grin.edu/~rebelsky/Tutorials/JavaScript/Spring1999/Examples/makemad.html

Source text last modified Wed Apr 14 12:33:04 1999.

This page generated on Wed Apr 14 12:39:11 1999 by SiteWeaver. Validate this page's HTML.