<script type='text/javascript' src='../dwr/engine.js'></script>
<script type='text/javascript' src='../dwr/util.js'></script>
<script type='text/javascript' src='../dwr/interface/majors.js'></script>
<script type='text/javascript'>
$(function() {
/*职位名 */
majors.getMajors(function(data) {
dwr.util.removeAllOptions("majorIds");
$("#majorIds").append("<option>请选择</option>");
dwr.util.addOptions("majorIds", data, "majorId", "majorName");
注意:majorIds是下拉列表的id值,majorId,majorname分别对应“text”和“value”的值
//默认值
$("#majorIds option[value='${exame.majorId.majorId}']").attr("selected",true);
});
/*EngageCommon.getComm("职位类型",function(data) {
dwr.util.removeAllOptions("majorIds");
$("#majorIds").append("<option>请选择</option>");
dwr.util.addOptions("majorIds", data, "commonid", "commonvalue");
});*/
});
<html>
<select name="majorIds" class="select1" id="majorIds">
</select>
</html>