Array Question
Hi,
I'm trying to write a small postcode coverage script. What I have is a list of postcodes in a select box, then a list of manufacturer numbers in the second select box. Then I'm trying to use the selectedIndex method of each box to pick the array element number I'm trying to reference. Here is a small example of the script:
<form name ="form1">
Postcodes:<br>
<select name = "sel1">
<option value =0>All other B Areas
<option value =1>BA
<option value =2>BN</option></select>
<br>
Manufacturer:<br>
<select name = "sel2">
<option value =0>Hotpoint
<option value =1>Creda
<option value =2>Cannon</option></select>
<button name = "but_click1" onclick = "getDetails()">Click</button>
</form>
<script language = "javascript">
function getDetails(){
var pArray = new Array()
pArray[0, 0] = "Hotpoint's number"
pArray[0, 1] = "Creda's Number"
pArray[0, 2] = "Cannon's Number"
pArray[1, 0] = "Not in this area"
pArray[1, 1] = "Creda's Number"
pArray[1, 2] = "Not in this area"
pArray[2, 0] = "Hotpoint's Number"
pArray[2, 1] = "Creda's Number"
pArray[2, 2] = "Not in this area"
var concat_indexNos = alert(pArray[document.form1.sel1.selectedIndex, document.form1.sel2.selectedIndex])
}
</script>
All I keep getting though is the last referenced element, almost like it gets stuck in there. Am I being really thick here, I don't understand!
TIA
Joe
__________________
\'sync\' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.
|