HTML and CSS Reference
Practice the skills
you learned in
the tutorial using
the same case
Data Files needed for the Review Assignments: 0.png - 9.png, modernizr-1.5.js, mpl.jpg,
mpl2txt.htm, mplstyles.css, random.js
Kate has a new assignment for you. One of the pages on the Monroe Public Library Web
site is the library records page, which contains sensitive information about library patrons
and the topics they have checked out. Kate has created a Web form in which a staff mem-
ber enters a username and password before getting access to the library records. However,
Kate has heard that some hackers create programs that search for Web forms that open
confidential pages. One technique of these hackers is to have automated programs that
submit thousands of username/password combinations, hoping to break into the system.
Kate knows that some sites use human input validation to thwart these programs.
Human input validation is a technique that requires the entry of a piece of informa-
tion that humans can easily enter, but automated programs cannot. One approach is to
display a completely automated public Turing test to tell computers and humans apart
(CAPTCHA) requesting that each user enter the numbers or letters being displayed on the
screen. Because most automated programs can't “see” images, they cannot answer this
question; most humans, on the other hand, can enter the requested information with-
out trouble. Kate suggests you write a program that shows five images, each displaying
a random number between 0 and 9. In addition to entering a username and password,
users will be required to enter the numbers they see on the screen. Figure 10-36 shows a
preview of the completed Web page.
Library records page
Your job is to write a script to display the random images. The images have been
stored in files named 0.png through 9.png . To help you, Kate has located a file that
which is represented by the size parameter. The name of the function is randomInteger,
so to call the function, you use the command
randomInteger( size )
For example, to return a random integer from 0 to 5, you would run the command
The randomInteger() function has been saved for you in the random.js file.