首页 > 代码库 > easyui combobox动态默认选项设置
easyui combobox动态默认选项设置
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <!-- 引入JQuery --> <script type="text/javascript" src="../JQuery-EasyUI-1.5.1/jquery.min.js"></script> <!-- 引入EasyUI --> <script type="text/javascript" src="../JQuery-EasyUI-1.5.1/jquery.easyui.min.js"></script> <!-- 引入EasyUI的中文国际化js,让EasyUI支持中文 --> <script type="text/javascript" src="../JQuery-EasyUI-1.5.1/locale/easyui-lang-zh_CN.js"></script> <!-- 引入EasyUI的样式文件--> <link rel="stylesheet" href="../JQuery-EasyUI-1.5.1/themes/default/easyui.css" type="text/css"/> <!-- 引入EasyUI的图标样式文件--> <link rel="stylesheet" href="../JQuery-EasyUI-1.5.1/themes/icon.css" type="text/css"/> </head> <body> <table id="dg" title="My Users" class="easyui-datagrid" style="width: 550px; height: 250px" toolbar="#toolbar" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="firstname" width="50">First Name</th> <th field="lastname" width="50">Last Name</th> <th field="phone" width="50">Phone</th> <th field="email" width="50">Email</th> </tr> </thead> </table> <div id="toolbar"> <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">New User</a> <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">Edit User</a> <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyUser()">Remove User</a> </div> <div> <select id="cc" class="easyui-combobox" name="dept" style="width:200px;"> </select> </div> <script type="text/javascript"> var sq=2; $(‘#cc‘).combobox({ data:[{text:‘AAA‘,value:‘0‘,selected:true}, {text:‘BBB‘,value:‘1‘}, {text:‘CCC‘,value:‘2‘}, {text:‘DDD‘,value:‘3‘}],
onl oadSuccess:function(){
$(this).combobox(‘select‘,sq);
} }); </script> </body> </html>
easyui combobox动态默认选项设置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。