Prototype machen Option in ausgewählten
bevölkert von Optionen (Länderliste) mit Protype:
for (var i = 0; i < j.length; ++i) {
var opt = new Element('option', {value:j[i].country})
opt.innerHTML = j[i].country_name;
country.appendChild(opt);
}
jetzt brauche ich Option, um von Wert zu wählen, somethhing wie
function selectByValue(countryCode) {
// make option selected where option value == countryCode
}
Wie geht das mit Prototype?
Seltsam, document.getElementById ('Land'). Value = country alert (document.getElementById ('Land'). Value) Benachrichtigung gültig "Ländercode", aber in Combobox der alten (ersten) Wert ist nach wie vor ausgewählt, warum? – Zelid
Ok, habe das Problem gefunden, es funktioniert nicht, wenn