2
使用样机选项(国家列表)填充提供的值来选择:
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);
}
现在我需要做的选择由值来选择,somethhing像
function selectByValue(countryCode) {
// make option selected where option value == countryCode
}
如何用Prototype做到这一点?
奇怪, 的document.getElementById( '国家')。值= COUNTRYCODE 警报(的document.getElementById( '国家')。值) 警报有效 “COUNTRYCODE”,但在组合框中旧的(第一)值仍选中,为什么? – Zelid 2009-07-29 10:31:18