Hello...I have a really simple question that I need help with ASAP. Anyways, I have this script for an address book that has radio buttons A-Z, a submit button, and a separate window that displays results. It can be found at Anyways, What I want to do is use a drop down instead of radio buttons. What do I do? I have the drop down form all implemented in my script but I dont know what action or whatever to make it work. Help? Heres the code I have without the drop down, but with the radio buttons.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
var rcrd = new Object();
rcrd[0] = "Gracie Allen, Javascript programmer, Tel. 234-5678 ext 13"
+ "\rHarold Ammons, DHTML scripts editor, Tel. 777-0987 ext 23"
+ "\rJames Atkin, Research and Development, Tel. 777-0933 ext 17";
rcrd[1] = "George Burns, Database designer, Tel. 232-5178 ext 91"
+ "\rAnne Byzantine, Accountant, Tel. 456-0987 ext 33";
rcrd[2] = "Harrison Czar, Administration, Tel. 232-5178 ext 12";
rcrd[3] = "Dillard Dally, Corporate Efficiency, Tel. 232-5178 ext 88 "
+ "email: dillydally@corp.com"
+ "\rSandy Dodge, Secretarial, Tel. 456-6543 ext 44";
rcrd[4] = "Heloise Eloise, Human Relations, Tel. 232-2909 ext 59"
+ "\rJerry Ezzard, Political Liasson, Tel. 456-9800 ext 41";
rcrd[5] = "George Fatchance, Corporate Lending, Tel. 546-7712 ext 19"
+ "\rBjorn Fjord, Foreign Relations, Tel. 456-6651 ext 28";
function dataBase(isnform) {
for (var i = 0; i < 6; i++) {
if (isnform.alpha.checked) {
recnum = isnform.alpha.value;
}
}
if (rcrd[recnum] != null) {
document.isnform.display.value = rcrd[recnum];
}
else document.isnform.display.value = "Sorry, no listings for that letter.";
}
// End Hiding Script -->
</SCRIPT>
</head>
<body>
<form name="isnform">
<input type="radio" name="alpha" value="0">A</font></p>
<input type="radio" name="alpha" value="1">B</font></p>
<input type="radio" name="alpha" value="2">C</font></p>
<input type="radio" name="alpha" value="3">D</font></p>
<input type="radio" name="alpha" value="4">E</font></p>
<input type="radio" name="alpha" value="5">F</font></p>
<input type="button" name="but" value=" Find " onclick="dataBase(this.form)"></font></p>
<textarea name="display" rows="4" cols="57"></textarea>
</FORM>
</body>
</html>
Thanks TONS
Adam
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
var rcrd = new Object();
rcrd[0] = "Gracie Allen, Javascript programmer, Tel. 234-5678 ext 13"
+ "\rHarold Ammons, DHTML scripts editor, Tel. 777-0987 ext 23"
+ "\rJames Atkin, Research and Development, Tel. 777-0933 ext 17";
rcrd[1] = "George Burns, Database designer, Tel. 232-5178 ext 91"
+ "\rAnne Byzantine, Accountant, Tel. 456-0987 ext 33";
rcrd[2] = "Harrison Czar, Administration, Tel. 232-5178 ext 12";
rcrd[3] = "Dillard Dally, Corporate Efficiency, Tel. 232-5178 ext 88 "
+ "email: dillydally@corp.com"
+ "\rSandy Dodge, Secretarial, Tel. 456-6543 ext 44";
rcrd[4] = "Heloise Eloise, Human Relations, Tel. 232-2909 ext 59"
+ "\rJerry Ezzard, Political Liasson, Tel. 456-9800 ext 41";
rcrd[5] = "George Fatchance, Corporate Lending, Tel. 546-7712 ext 19"
+ "\rBjorn Fjord, Foreign Relations, Tel. 456-6651 ext 28";
function dataBase(isnform) {
for (var i = 0; i < 6; i++) {
if (isnform.alpha.checked) {
recnum = isnform.alpha.value;
}
}
if (rcrd[recnum] != null) {
document.isnform.display.value = rcrd[recnum];
}
else document.isnform.display.value = "Sorry, no listings for that letter.";
}
// End Hiding Script -->
</SCRIPT>
</head>
<body>
<form name="isnform">
<input type="radio" name="alpha" value="0">A</font></p>
<input type="radio" name="alpha" value="1">B</font></p>
<input type="radio" name="alpha" value="2">C</font></p>
<input type="radio" name="alpha" value="3">D</font></p>
<input type="radio" name="alpha" value="4">E</font></p>
<input type="radio" name="alpha" value="5">F</font></p>
<input type="button" name="but" value=" Find " onclick="dataBase(this.form)"></font></p>
<textarea name="display" rows="4" cols="57"></textarea>
</FORM>
</body>
</html>
Thanks TONS
Adam