In this lesson, you will design and implement a Web page interface for the palindrome program from the previous lesson. In addition to improving the robustness of this program, you will incorporate dynamic images in the page to make the page more expressive.
As you have seen throughout this course, the Web provides a simple and intuitive user-interface for accessing information. The use of form elements such as text boxes, text areas, and buttons allows the user to interact easily with the page. By embedding JavaScript programs in HTML code, it is possible to make use of this attractive and intuitive interface for programs. For example, a program which uses text boxes to read input and a text area to display output is usually more attractive and easy to use than one which uses prompt and alert boxes.
When writing a Web page to provide the user-interface for a JavaScript program, it is important to design that page carefully so that the page adds to the ease of use of the program. The extraneous use of colors, unnecessary or confusing form elements, or large images can detract from the page and overwhelm the user. Recall the three guidelines for Web page design: the page should be transparent (meaning that it should be intuitive to use, with unnecessary details hidden away), forgiving (meaning that it should handle mistakes gracefully), and visually-oriented.
Exercise 1:
Design and implement a Web page for reading in a word and determining if that word is a palindrome. The layout of the page and the type of form elements used to read in the word and display the results are entirely up to you. Your final page should be attractive and intuitive to use, however.
Note: you may make use of the isPalindrome function from the previous lesson.
In Lesson 23, you learned how to display images in a Web page using the IMG element. For example, including the following tag in a page would result in a picture being displayed (specifically, the picture stored at the address: http://www.dickinson.edu/~braught/courses/cs131s99/Images/dwr.gif).
|
Exercise 4:
Add images to your palindrome page so that it displays some "happy" image when the word/phrase is a palindrome, and some "unhappy" image when it is not. The actual images used are entirely up to you. Feel free to scour the net and find just the right images to express your own personal style.