Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 2nd, 2005, 06:04 AM
Friend of Wrox
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default Array Question


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">
<select name = "sel1">
<option value =0>All other B Areas
<option value =1>BA
<option value =2>BN</option></select>
<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>

<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])

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!

\'sync\' &lt;cr&gt;
The name specified is not recognized as an internal or external command, operable program or batch file.
Reply With Quote
  #2 (permalink)  
Old November 2nd, 2005, 07:34 AM
Friend of Wrox
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts

Sorted it! Thanks all.


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convering a String Array to an Integer array nkrust C# 9 November 17th, 2010 12:02 PM
Go from 2d Array to 1d array without defining type OneQuestion General .NET 1 January 10th, 2008 11:13 AM
Array question jamara ASP.NET 1.0 and 1.1 Professional 10 June 21st, 2006 12:10 PM
Question on the ARRAY function savoym VBScript 6 May 31st, 2005 06:53 AM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM

All times are GMT -4. The time now is 01:43 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.