Test 1/Spring '06 PC-Component Instructions

This portion of your test involves getting a couple of scripts working. It involves two parts: a script modification problem and either a debug or a programming problem. You are allowed to open Notepad, Dreamweaver, Visual Studio, and one or more browsers during the exam. The only sites/pages you may access through the browser windows are:

Please do not open any other applications, web sites, or other files containing javascript code. Opening other applications will result in a grade of "F" for this exam. Remember to write code that is xhtml compliant. Good luck!

Part 1: Modification of Existing Script (25 points)

Below, I have given you a link to a file containing a script downloaded from a script library. It contains a combo box, a text area, and a button. The combo box lists different web sites, the text area displays a description of the site currently showing in the combo box, and the button, when pressed, takes the user to the site identified by the combo box. Begin by changing the text on the button to read "Load Site". Finish by modifying the code so that the sites and descriptions match those shown below:

Site Name
Site URL
Description
DevGuru http://www.devguru.com/ A wonderful reference for web programming featuring languages such as ASP, CSS2, JavaScript, PHP, VBScript, XHTML, XML
Tarnoff's CSCI Home http://faculty.etsu.edu/tarnoff/ A site that all of the downtrodden students in Tarnoff's classes need to visit
CSCI
Web Site
http://zephy.etsu.edu/ ETSU's CSCI Department has a new web site. It's still growing and changing, so visit often
ETSU
Web Site
http://www.etsu.edu/ ETSU's Homepage provides information regarding attending ETSU or working there

The file you are to modify can be downloaded from: http://faculty.etsu.edu/tarnoff/labs2910/t1_s06/modify.htm. When you have completed this portion of the program, send it to me using your digital dropbox in Blackboard. Use the file name <your_last_name>_modify.htm. For example, John Smith would submit the file "smith_modify.htm".

Be careful in your editing. There is already one debugging exercise here, and this one isn't supposed to be it.

Part 2: Either Debug Existing Code or Write New Code (30 points)

For this last portion of the test, I'm allowing you to pick one of two options, either a debugging exercise or a coding exercise.

Option 1: Debugging Exercise

I have created an XHTML file containing a form and a script to be executed when a button on the form is pressed. There are six errors in the page, each of which can be corrected by simply changing one or two characters in the code. There might be a problem with the syntax implementing the program's logic, but there is no problem with the logic itself. The structure of the program and the numeric algorithms are correct. Of the six errors, two are in the form and four are in the script. The script is heavily commented, so you should not have any problem figuring out what does what.

The file you are to debug can be downloaded from: http://faculty.etsu.edu/tarnoff/labs2910/t1_s06/debug.htm. When you have completed this portion of the program, send it to me using your digital dropbox in Blackboard. Use the file name <your_last_name>_debug.htm. For example, John Smith would submit the file "smith_debug.htm".

Option 2: Coding Exercise

I have created an XHTML file containing a form with a combo box listing the URLs of three different images, a button labeled "Get Picture", and a text box. There is also a 200 pixel by 100 pixel blank image located in the XHTML file that has the name/id attribute "mypict". If you select this option, your goal is to write a script that when the button is pressed, replaces the image with the image found at the URL specified by the combo box and sets the text box to the corresponding description as found in the table below.

Image Name

Image URL

Description

Sunset http://faculty.etsu.edu/tarnoff/labs2910/js/images/image01.jpg Sunset off of Kiawah Island
Squirrel http://faculty.etsu.edu/tarnoff/labs2910/js/images/image02.jpg Casey's archnemesis
Bear http://faculty.etsu.edu/tarnoff/labs2910/js/images/image05.jpg Bear at Grandfather Mountain

The button already has associated with it an "onClick" event pointing to the JavaScript function "changePicture()". This function has not been written. There is not even a prototype for it in the code. Write this function so that it performs the previously described operations.

The XHTML file to which you are to add your script can be downloaded from: http://faculty.etsu.edu/tarnoff/labs2910/t1_s06/coding.htm. When you have completed this portion of the program, send it to me using your digital dropbox in Blackboard. Use the file name <your_last_name>_coding.htm. For example, John Smith would submit the file "smith_coding.htm".