コンボボックスにはいくつかの値があり、いくつかの値もあります。コンボボックスから1つの値を選択し、操作を行って、選択した値に戻ります(これらの値をセッションに設定します)。ここで、コンボ ボックスでセッション中の値を自動的に選択する必要があります。
以下の JavaScript に従っていますが、正常に動作しますが、既にコンボ ボックスにある値が重複して作成されます。
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 = "";
}
誰かが私を特定するのを手伝ってくれますか?