codice:
var arItems = new Array()
arItems = [
[1,1,'8.1.7.3.0 - 64bit Production']
[1,2,'8.1.7.3.0 - Production'][1,3,'8.1.7.4.0 - 64bit Production']
[1,4,'9.0.1.5.1 - Production']
[1,5,'9.2.0.1.0 - Production'][1,6,'9.2.0.3.0 - Production']
[1,7,'9.2.0.4.0 - 64bit Production'][2,8,'9.2.0.4.0 - Production']
[2,25,'12345hhh']
]
</script>
<script>
function fillItems( intStart ) {
var fTypes = document.add_db.db_sw;
var fItems = document.add_db.db_version;
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>
nella prima parte ho l'array (che ho definito col php)
nella seconda c'é la funzione (che non penso funzioni)
codice:
<td>
<SELECT name="db_sw" id="db_sw" onChange="fillItems(0);">
<option value="">select a sw type...</option>
<option value="1">oracle</option>
<option value="2">mysql</option>
<option value="3">SQL Server</option>
<option value="5">test</option>
</SELECT>
</td>
<td>
<SELECT name="db_version" id="db_version">
</SELECT>
</td>
la seconda select é vuota perché dovrebbe essere popolata dalla funzione..
help