easyui常用控件常用方法

古城微笑少年丶 2022-08-10 09:55 514阅读 0赞
  1. easyui常用控件使用方法:
  2. 1.文本框 <input class="easyui-textbox" style="width:100%;height:32px"> 取值 $("#id").textbox("getValue") $("#id").val()
  3. 2.链接按钮 <a href="#" class="easyui-linkbutton" iconCls="icon-ok" style="width:100%;height:32px">Register</a>
  4. 3.日历控件 显示年月日 <input type="text" class="easyui-datebox" style="width:100px" id="kssj"> 取值$("#kssj").datebox('getValue')
  5. 显示年月日时分秒 <input class="easyui-datetimebox" style="width:150px" editable="false" id="regtime"> 取值$("#regtime").datetimebox('getValue')
  6. 显示年月 <input type="text" class="easyui-datetimespinner" data-options="formatter:formatter2,parser:parser2,selections:[[0,4],[5,7]]" style="width:100px" value="6/24/2014" id="tjrq">
  7. function formatter2(date)
  8. {
  9. if(!date)
  10. {
  11. return '';
  12. }
  13. var y=date.getFullYear();
  14. var m=date.getMonth() + 1;
  15. return y + '-' + (m<10?('0'+m):m);
  16. }
  17. function parser2(s)
  18. {
  19. if(!s)
  20. {
  21. return null;
  22. }
  23. var ss=s.split('-');
  24. var y=parseInt(ss[0],10);
  25. var m=parseInt(ss[1],10);
  26. if(!isNaN(y) && !isNaN(m))
  27. {
  28. return new Date(y,m-1,1);
  29. }
  30. else
  31. {
  32. return new Date();
  33. }
  34. }
  35. 取值 $("#tjrq").datetimespinner('getValue')
  36. 4.下拉框 <input class="easyui-combobox" id="workid" style="width:150px"
  37. data-options="url:'getAllWorkShopServlet',method:'post',valueField:'id',
  38. textField:'text',panelHeight:'300',editable:false">
  39. 取值 $("#workid").combobox("getValue") 取显示的文本 $("#workid").combobox("getText")
  40. 下拉框可以选取多个值 <input class="easyui-combobox" id="jobid" style="width:150px;height:80px"
  41. data-options="url:'getAllJobCommon',method:'post',valueField:'id',editable:false,
  42. textField:'text',multiple:true,panelHeight:'300',multiline:true">
  43. 取值 var jobid=$("#jobid").combobox("getValues"); jobid=jobid+"";
  44. 5.表单的提交事件 $('#ff').form('submit')
  45. 6.表单的清空事件 $('#ff').form('clear')
  46. 7.消息提示框 $.messager.alert('消息提示框','更新成功!')
  47. 8.消息确认框
  48. $.messager.confirm('消息提示框','您确定要退出吗?',function(r)
  49. {
  50. if(r)
  51. {
  52. location='quitServlet';
  53. }
  54. });
  55. 9.easyui combox设置默认值:<select style="width:150px" class="easyui-combobox" id="name"
  56. data-options="value:'${sessionScope.work.unitname }'">
  57. </select>

发表评论

表情:
评论列表 (有 0 条评论,514人围观)

还没有评论,来说两句吧...

相关阅读