second array is depending on the first?

  • Thread starter Lodewijk van Haringhal
  • Start date
L

Lodewijk van Haringhal

I have two listboxes one is selecting the directory and second is selecting
the file. The script is than showing the file (it's a picture)

In the script bellow (including the html) I have to fill the first list box
(directory choice) with empty values (option value 6 - 10) to choose a file
wich has a higher listbox range than the number I have entered at the fist
directory list box? Anyone knows a solution for this problem?


<HTML>
<TITLE>test</TITLE>
<BODY>
<SCRIPT LANGUAGE="javascript">
function changePicture()
{
var picLocation = new Array ("", "carlos/Gif thumbs vk/", "carlos/Gif thumbs
vk/", "klei/Gif thumbs vk/",
"pic/", "pic/", "pic/"); //verander bestandslocatie

var picFile = new Array ("leeg.gif", "01vk.gif", "02vk.gif", "03vk.gif",
"04vk.gif", "05vk.gif", "06vk.gif", "07vk.gif",
"08vk.gif", "09vk.gif", "10vk.gif"); //verander bestandsnaam

/* Laat de eerste leeg mits je tekst wilt gebruiken */
var picText = new Array ("", "Kaart 1", "Kaart 2", "Kaart 3", "Kaart 4",
"Kaart 5", "Kaart 6", "Kaart 7", "Kaart 8", "Kaart
9", "Kaart 10");

var selection = document.DropPicture.Picture.selectedIndex;
var selection2 = document.DropPicture.Directory.selectedIndex;
var theChoice = document.DropPicture.Picture.options[selection].value;
var theChoice2 = document.DropPicture.Directory.options[selection].value;
document.pic.src = picLocation[selection2] + picFile[selection];
document.all.picWords.innerText = picText[theChoice];
}
</SCRIPT>

<CENTER>
<FORM NAME="DropPicture">
<SELECT NAME="Directory" onChange="changePicture()">
<OPTION SELECTED VALUE=1>Kies Collectie

<option value="1">Bladibla </option>
<option value="2">Zookie </option>
<option value="3">PlasticZoo </option>
<option value="4">Woelie </option>
<option value="5">T-Kaart </option>
<option value="6"> </option>
<option value="7"> </option>
<option value="8"> </option>
<option value="9"> </option>
<option value="10"> </option>
</SELECT>


<SELECT NAME="Picture" onChange="changePicture()">
<OPTION SELECTED VALUE=0>Kies kaart
<OPTION VALUE=1>1
<OPTION VALUE=2>2
<OPTION VALUE=3>3
<OPTION VALUE=4>4
<OPTION VALUE=5>5
<OPTION VALUE=6>6
<OPTION VALUE=7>7
<OPTION VALUE=8>8
<OPTION VALUE=9>9
<OPTION VALUE=10>10
</SELECT>
</FORM>

<div align="left"><br>
<br>
<br>
<br>
<br>
<br>
<IMG SRC="leeg.gif" NAME="pic" BORDER="1"><br>
<SPAN ID="picWords" NAME="picWords"></SPAN><br><br>
<SPAN ID="locatie" NAME="locatie"></SPAN>
</div>
</CENTER>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top