'bestellijst'

Status
Niet open voor verdere reacties.

MichaelMafiosa

Gebruiker
Lid geworden
11 apr 2007
Berichten
77
Hoi scripters,

Ik ben voor school bezig met een project en daarvoor moet ik een soort bestellijst maken. Ik heb de volgende stukken code, alleen daar heb ik wat hulp bij nodig.:D

Dit staat in de body van me HTML
HTML:
<table cellpadding=4 cellspacing=4 border=0>
                <tr>
                    <form name=form method=post action="">
                        <td><span class=DefMenuText>Productgroep</span><br>
                                <select name='category' size=1 style="width:120;"
                                        onChange='javascript:populateData( this.options [selectedIndex] .text )'>
                                                <option>Afbouw</option>
                                                <option>Gereedschap e.d.</option>
                                                <option>Schilderwerk</option>
                                </select>
                        </td>
                        <td><span class=DefMenuText>Materiaal</span><br>
                                <select name="SubCategory" size=1 style="width:120;">
                                </select>
                        </td>
                    </form>
                </tr>
        </table>

Dit staat in een extern Javascript bestand:
HTML:
var arrayData = new Array();
  arrayData[0]	= 'Afbouw|Hout 1|'
  arrayData[1]	= 'Afbouw|Hout 2|'
  arrayData[2]	= 'Afbouw|Hout 3|'
  arrayData[3]	= 'Gereedschap e.d.|Zaag 1|'
  arrayData[4]	= 'Gereedschap e.d.|Zaag 2|'
  arrayData[5]	= 'Gereedschap e.d.|Zaag 3|'
  arrayData[6]	= 'Schilderwerk|Verf 1|'
  arrayData[7]	= 'Schilderwerk|Verf 2|'
  arrayData[8]	= 'Schilderwerk|Verf 3|'

function populateData( name ) {
	select	= window.document.form.SubCategory;
	string	= "";
		// 0 - will display the new options only
		// 1 - will display the first existing option plus the new options
	count	= 0;

		// Clear the old list (above element 0)
	select.options.length = count;

		// Place all matching categories into Options.
	for( i = 0; i < arrayData.length; i++ ) {
		string = arrayData[i].split( "|" );
		if( string[0] == name ) {
			select.options[count++] = new Option( string[1] );
		}
	}

// Set which option from subcategory is to be selected
//	select.options.selectedIndex = 2;
		// Give subcategory focus and select it
//	select.focus();
}

Het is nu dus zo, als ik in menu 1 Afbouw kies, heb ik de keuze uit Hout 1, Hout 2, Hout 3. Als ik voor Gereedschap kies: Zaag 1, Zaag2, etc. etc. Nu wil ik er eigenlijk nog 3 menu'tjes bij met maatvoering, aantal, en leverancier. Scenario: Ik kies voor afbouw, dan kies ik Hout 3, Dan kies ik 10 x 10 x 10, dan aantal 10 , en dan leverencier Gamma.

Ik krijg de andere menutjes alleen niet voor elkaar. En ik zou graag willen dat de menutjes onder elkaar komen en niet naast elkaar.

Kan iemand mij helpen??

Greetz Michael
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan