<html>
<head>
<script>
function data(fn,ln,phone)
 {this.first = fn
  this.last = ln
  this.phone = phone
}

var names = new Array(6)

names[0] = new data("Sue","Smith","336-5344");
names[1] = new data("Mary","Hayes","213-3456");
names[2] = new data("Kelly","Jones","212-9876");
names[3] = new data("Fred","Lawrence","613-5645");
names[4] = new data("Tom","Perry","334-6767");
names[5] = new data("Mike","Kelly","356-6444");

function findPhone(na)
{alert("hello");
var x;
var out = "";
for (x = 0; x < 6; x++)
  {

for (x = 0; x < 6; x++)
  {if (names[x].first == na)
   out =out + " Last: "+names[x].last + " Phone : "+names[x].phone + "\n"; 
if (names[x].last == na)
   out =out + " First: "+names[x].first + " Phone : "+names[x].phone + "\n"; 
if (na == names[x].first + " " + names[x].last)
out =out + " First: "+names[x].first +  " Last: "+names[x].last +" Phone : "+names[x].phone + "\n"; 
}
if (out =="")
{alert("Not on File");}
else
{ alert(out);
}
}
}

</script>

</head>
<body>
Enter the first name or 
the last name of the 
person whose phone number you wanted
<form name = "main"> <input type = "text" name = da size = 30> <input type = "button" value = "Click Here" onClick="findPhone(document.main.da.value)"> </form> </body> </html>