我有一个 JavaScript 填充下拉列表中的值。根据下拉列表中的选择,我需要更新下一个组合框的标签。
JavaScript如下:
onLoad: function(){
......
label.innerHTML = this._Strings.abcd_TableLabelMount;
this.disks.refreshHeader();
this._formatSelect.store.root.options.length = 3;
this._formatSelect.store.root.options[0].text = "NTFS";
this._formatSelect.store.root.options[0].value = "ntfs";
this._formatSelect.store.root.options[1].text = "FAT32";
this._formatSelect.store.root.options[1].value = "fat32";
this._formatSelect.store.root.options[2].text = this._Strings.abcd_None;
this._formatSelect.store.root.options[2].value = "-1";
this.xyzVal.invalidMessage = this._Strings.abcd_InvalidDrive;
}
HTML如下:
<div class="input_field">
<label class="label required" for="${id}_ABCD_XYZ" id="${id}_ABCD_XYZ_LABEL">${_Strings.abcd_TableLabelMount}</label>
<input id="${id}_ABCD_XYZ" dojoAttachPoint="xyzVal" dojoType="dijit.form.ValidationTextBox" required="true" maxLength="30" size="32">
如果用户选择 NTFS 选项,我需要${_Strings.abcd_TableLabelMount}
为下一个组合框显示标签为“NTFS”,依此类推。你能建议一个更好的方法来做同样的事情吗?