COMP 313 Lab 5

Points: 30 Due Date: Thursday May 19, 2005

This involves practice with JavaScript and arrays.

You will prompt the user (probably using a form) for a number. Provide a button to search for the number. You will then search an array of numbers to see if the requested number is in the array. If is is, display a message (using the form) to the user that the number was found and what array element it was in. If the value is not found, you should tell the user that it wasn't found.

You will use the array below.

var data = new Array(5, -2, 10,42,47,-8, 100, 96, -15, 56);
Your code shouldn't depend on the fact that this array has 10 elements. It should figure out the array length.

Here is a screen shot of my solution. The first is what it looks like when it finds the number, the second is when it doesn't find it. asg 5 example succeed asg 5 example fail

Deliverables:

You can email me the page or use the eCollege drop box.

Notes


ASK if you have any questions.