Ciao ragazzi mi date una mano non riesco a capire perchè non funziona questo script.
<script language="JavaScript">
var arItems = new Array()
arItems = [
[AUTO, 10, 'BMW'],
[AUTO, 10, 'ALFA'],
[AUTO, 10, 'fiat'],
[AUTO, 10, 'AUDI'],
[AUTO, 10, 'renault'],
[AUTO, 10, 'seat']
]
function fillItems( intStart ) {
var fTypes = document.form1.types
var fItems = document.form1.items
var a = arItems
var b, c, d, intItem, intType
if ( intStart > 0 ) {
for ( b = 0; b < a.length; b++ ) {
if ( a[b][1] == intStart ) {
intType = a[b][0];
}
}
for ( c = 0; c < fTypes.length; c++ ) {
if ( fTypes.options[ c ].value == intType ) {
fTypes.selectedIndex = c;
}
}
}
if ( intType == null ) {
intType = fTypes.options[ fTypes.selectedIndex ].value
}
fItems.options.length = 0;
for ( d = 0; d < a.length; d++ ) {
if ( a[d][0] == intType ) {
fItems.options[ fItems.options.length ] = new Option( a[d][2], a[d][1] ); // no line-break here
}
if ( a[d][1] == intStart ) {
fItems.selectedIndex = fItems.options.length - 1;
}
}
}
</script>
<form name="form1">
<select name="types" onChange="fillItems(0)">
<option value="#" selected="selected">Please select</option>
<option value="AUTO">AUTO</option>
<option value="MOTO">MOTO</option>
<option value="CAMPER">CAMPER</option>
<option value="ciao">ciao</option>
</select>
<select name="items"></select>
</form>
Grazie mille
Andrea