actions.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>ComboBox Actions - jQuery EasyUI Demo</title>
  6. <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="../demo.css">
  9. <script type="text/javascript" src="../../jquery.min.js"></script>
  10. <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
  11. </head>
  12. <body>
  13. <h2>ComboBox</h2>
  14. <p>Click the buttons below to perform actions.</p>
  15. <div style="margin:20px 0;">
  16. <a href="javascript:void(0)" class="easyui-linkbutton" onclick="setvalue()">SetValue</a>
  17. <a href="javascript:void(0)" class="easyui-linkbutton" onclick="alert($('#state').combobox('getValue'))">GetValue</a>
  18. <a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#state').combobox('disable')">Disable</a>
  19. <a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#state').combobox('enable')">Enable</a>
  20. </div>
  21. <div class="easyui-panel" style="width:100%;max-width:400px;padding:30px 60px;">
  22. <div style="margin-bottom:20px">
  23. <select id="state" class="easyui-combobox" name="state" label="State:" labelPosition="top" style="width:100%;">
  24. <option value="AL">Alabama</option>
  25. <option value="AK">Alaska</option>
  26. <option value="AZ">Arizona</option>
  27. <option value="AR">Arkansas</option>
  28. <option value="CA">California</option>
  29. <option value="CO">Colorado</option>
  30. <option value="CT">Connecticut</option>
  31. <option value="DE">Delaware</option>
  32. <option value="FL">Florida</option>
  33. <option value="GA">Georgia</option>
  34. <option value="HI">Hawaii</option>
  35. <option value="ID">Idaho</option>
  36. <option value="IL">Illinois</option>
  37. <option value="IN">Indiana</option>
  38. <option value="IA">Iowa</option>
  39. <option value="KS">Kansas</option>
  40. <option value="KY">Kentucky</option>
  41. <option value="LA">Louisiana</option>
  42. <option value="ME">Maine</option>
  43. <option value="MD">Maryland</option>
  44. <option value="MA">Massachusetts</option>
  45. <option value="MI">Michigan</option>
  46. <option value="MN">Minnesota</option>
  47. <option value="MS">Mississippi</option>
  48. <option value="MO">Missouri</option>
  49. <option value="MT">Montana</option>
  50. <option value="NE">Nebraska</option>
  51. <option value="NV">Nevada</option>
  52. <option value="NH">New Hampshire</option>
  53. <option value="NJ">New Jersey</option>
  54. <option value="NM">New Mexico</option>
  55. <option value="NY">New York</option>
  56. <option value="NC">North Carolina</option>
  57. <option value="ND">North Dakota</option>
  58. <option value="OH" selected>Ohio</option>
  59. <option value="OK">Oklahoma</option>
  60. <option value="OR">Oregon</option>
  61. <option value="PA">Pennsylvania</option>
  62. <option value="RI">Rhode Island</option>
  63. <option value="SC">South Carolina</option>
  64. <option value="SD">South Dakota</option>
  65. <option value="TN">Tennessee</option>
  66. <option value="TX">Texas</option>
  67. <option value="UT">Utah</option>
  68. <option value="VT">Vermont</option>
  69. <option value="VA">Virginia</option>
  70. <option value="WA">Washington</option>
  71. <option value="WV">West Virginia</option>
  72. <option value="WI">Wisconsin</option>
  73. <option value="WY">Wyoming</option>
  74. </select>
  75. </div>
  76. </div>
  77. <script type="text/javascript">
  78. function setvalue(){
  79. $.messager.prompt('SetValue','Please input the value(CO,NV,UT,etc):',function(v){
  80. if (v){
  81. $('#state').combobox('setValue',v);
  82. }
  83. });
  84. }
  85. </script>
  86. </body>
  87. </html>