일부 값을 가진 콤보 상자가 있는데, 몇 가지 값이 있습니다. 콤보 상자에서 하나의 값을 선택하고 조작을 수행하고 선택한 값으로 돌아옵니다 (세션에서이 값들을 설정하십시오). 이제 콤보 상자에서 세션에있는 값을 자동으로 선택해야합니다.동적으로 생성 된 combobox에서 중복 값을 제거합니다.
나는 자바 스크립트 아래 따랐다하고 그것을 잘 작동하지만, 콤보 상자에 이미 중복 값을 생성합니다
function addCombo() {
var reportID = '<%=reportid%>';
var reportName = '<%=reportname%>';
var textb = document.getElementById("reportnames");
var option = document.createElement("option");
option.text = reportName;
option.value = reportID;
option.selected='selected';
try {
textb.add(option, null); //Standard
}catch(error) {
textb.add(option); // IE only
}
textb.value = "";
}
사람을 식별하는 데 도움이 수 있습니까? 그것은 나를 해결,
이 링크는 도움이 될 수 있습니다. http://stackoverflow.com/questions/4590311/set-option-selected-attribute-from-dynamic-created-option – Anoop