checkbox.htm 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <#def title = "多选框样式"/>
  2. <#def keyword = "ZhiqimUI"/>
  3. <#def desc = "多选框样式是指参考多选按钮设计出有颜色设定的多选的方框样式。多选框默认1像素边框,移入时变为2像素边框,选中后增加背景颜色并显示打勾图标表示已选中,多选框默认黑色,支持红橙黄绿青蓝紫等颜色和大小5种设定。"/>
  4. <#def prevUrl = "button.htm"/>
  5. <#def nextUrl = "radio.htm"/>
  6. ${zhiqim_com_header()}
  7. ${zhiqim_com_topnav()}
  8. <script>
  9. Z.onload(function()
  10. {
  11. Z(".example").each(function(elem)
  12. {
  13. Z(elem).next("td > pre").html(Z(elem).htmlt());
  14. });
  15. Z(".example-link").each(function(elem)
  16. {
  17. var html = Z(elem).htmlt();
  18. html = Z.S.trim(html);
  19. html = Z.S.replaceAll(html, /\sdata-id="[^"]+"/g, ''); //去除 data-id
  20. html = Z.S.replaceAll(html, /\sstyle="[^"]+"/g, '');
  21. html = Z.S.replaceAll(html, ' &gt;', '&gt;');
  22. var ind = html.indexOf("i ");
  23. if (ind != -1){
  24. html = html.substring(0, ind-4);
  25. }
  26. Z(elem).next("td > pre").html(html);
  27. });
  28. Z(".click i.z-checkbox").click(function()
  29. {
  30. Z(this).toggleClass("z-active");
  31. });
  32. });
  33. function abc(text, checked)
  34. {
  35. alert(text+checked);
  36. }
  37. </script>
  38. <!--容器开始 -->
  39. <div id="container" class="container">
  40. <!--边导航-->
  41. ${zhiqim_com_ui("tutorial", "ui", "form", "checkbox")}
  42. <!--主体-->
  43. <div id="mainbody" class="mainbody">
  44. ${zhiqim_com_breadcrumb("文库", "教程", "多选框样式")}
  45. <div class="content">
  46. <#-- 标题 -->
  47. <div class="z-relative-left z-w100p z-pd16 z-bg-blue z-px18 z-lh200p z-bold" style="border-left:5px solid #2293e4">
  48. <p class="z-text-blue">多选框样式:</p>
  49. <p class="z-color-333" style="text-indent:38px;">
  50. 多选框样式是指参考多选按钮设计出有颜色设定的多选的方框样式。多选框默认1像素边框,移入时变为2像素边框,选中后增加背景颜色并显示打勾图标表示已选中,多选框默认黑色,支持红橙黄绿青蓝紫等颜色和大小5种设定。
  51. </p>
  52. </div>
  53. <#-- 一、纯多选框样式 -->
  54. <div class="tutorial title">一、纯多选框样式(标准大小)</div>
  55. <table class="click z-table z-bordered z-pd10">
  56. <tr bgcolor="#f5f5f5">
  57. <td width="10%">类型</td>
  58. <td width="8%">未选中</td>
  59. <td width="30%">未选中代码</td>
  60. <td width="8%">已选中</td>
  61. <td width="44%">未选中代码</td>
  62. </tr>
  63. <tr>
  64. <td>默认</td>
  65. <td class="example"><i class="z-checkbox"></i></td>
  66. <td><pre class="z-text-preline"></pre></td>
  67. <td class="example"><i class="z-checkbox z-active"></i></td>
  68. <td><pre class="z-text-preline"></pre></td>
  69. </tr>
  70. <tr>
  71. <td>红色</td>
  72. <td class="example"><i class="z-checkbox z-red"></i></td>
  73. <td><pre class="z-text-preline"></pre></td>
  74. <td class="example"><i class="z-checkbox z-red z-active"></i></td>
  75. <td><pre class="z-text-preline"></pre></td>
  76. </tr>
  77. <tr>
  78. <td>橙色</td>
  79. <td class="example"><i class="z-checkbox z-orange"></i></td>
  80. <td><pre class="z-text-preline"></pre></td>
  81. <td class="example"><i class="z-checkbox z-orange z-active"></i></td>
  82. <td><pre class="z-text-preline"></pre></td>
  83. </tr>
  84. <tr>
  85. <td>黄色</td>
  86. <td class="example"><i class="z-checkbox z-yellow"></i></td>
  87. <td><pre class="z-text-preline"></pre></td>
  88. <td class="example"><i class="z-checkbox z-yellow z-active"></i></td>
  89. <td><pre class="z-text-preline"></pre></td>
  90. </tr>
  91. <tr>
  92. <td>绿色</td>
  93. <td class="example"><i class="z-checkbox z-green"></i></td>
  94. <td><pre class="z-text-preline"></pre></td>
  95. <td class="example"><i class="z-checkbox z-green z-active"></i></td>
  96. <td><pre class="z-text-preline"></pre></td>
  97. </tr>
  98. <tr>
  99. <td>青色</td>
  100. <td class="example"><i class="z-checkbox z-cyan"></i></td>
  101. <td><pre class="z-text-preline"></pre></td>
  102. <td class="example"><i class="z-checkbox z-cyan z-active"></i></td>
  103. <td><pre class="z-text-preline"></pre></td>
  104. </tr>
  105. <tr>
  106. <td>蓝色</td>
  107. <td class="example"><i class="z-checkbox z-blue"></i></td>
  108. <td><pre class="z-text-preline"></pre></td>
  109. <td class="example"><i class="z-checkbox z-blue z-active"></i></td>
  110. <td><pre class="z-text-preline"></pre></td>
  111. </tr>
  112. <tr>
  113. <td>紫色</td>
  114. <td class="example"><i class="z-checkbox z-purple"></i></td>
  115. <td><pre class="z-text-preline"></pre></td>
  116. <td class="example"><i class="z-checkbox z-purple z-active"></i></td>
  117. <td><pre class="z-text-preline"></pre></td>
  118. </tr>
  119. </table>
  120. <#-- 二、纯多选框样式(大号) -->
  121. <div class="tutorial title">二、纯多选框样式(大号)</div>
  122. <table class="click z-table z-bordered z-pd10">
  123. <tr bgcolor="#f5f5f5">
  124. <td width="10%">类型</td>
  125. <td width="8%">未选中</td>
  126. <td width="30%">未选中代码</td>
  127. <td width="8%">已选中</td>
  128. <td width="44%">未选中代码</td>
  129. </tr>
  130. <tr>
  131. <td>默认</td>
  132. <td class="example"><i class="z-checkbox z-large"></i></td>
  133. <td><pre class="z-text-preline"></pre></td>
  134. <td class="example"><i class="z-checkbox z-large z-active"></i></td>
  135. <td><pre class="z-text-preline"></pre></td>
  136. </tr>
  137. <tr>
  138. <td>红色</td>
  139. <td class="example"><i class="z-checkbox z-red z-large"></i></td>
  140. <td><pre class="z-text-preline"></pre></td>
  141. <td class="example"><i class="z-checkbox z-red z-large z-active"></i></td>
  142. <td><pre class="z-text-preline"></pre></td>
  143. </tr>
  144. <tr>
  145. <td>橙色</td>
  146. <td class="example"><i class="z-checkbox z-orange z-large"></i></td>
  147. <td><pre class="z-text-preline"></pre></td>
  148. <td class="example"><i class="z-checkbox z-orange z-large z-active"></i></td>
  149. <td><pre class="z-text-preline"></pre></td>
  150. </tr>
  151. <tr>
  152. <td>黄色</td>
  153. <td class="example"><i class="z-checkbox z-yellow z-large"></i></td>
  154. <td><pre class="z-text-preline"></pre></td>
  155. <td class="example"><i class="z-checkbox z-yellow z-large z-active"></i></td>
  156. <td><pre class="z-text-preline"></pre></td>
  157. </tr>
  158. <tr>
  159. <td>绿色</td>
  160. <td class="example"><i class="z-checkbox z-green z-large"></i></td>
  161. <td><pre class="z-text-preline"></pre></td>
  162. <td class="example"><i class="z-checkbox z-green z-large z-active"></i></td>
  163. <td><pre class="z-text-preline"></pre></td>
  164. </tr>
  165. <tr>
  166. <td>青色</td>
  167. <td class="example"><i class="z-checkbox z-cyan z-large"></i></td>
  168. <td><pre class="z-text-preline"></pre></td>
  169. <td class="example"><i class="z-checkbox z-cyan z-large z-active"></i></td>
  170. <td><pre class="z-text-preline"></pre></td>
  171. </tr>
  172. <tr>
  173. <td>蓝色</td>
  174. <td class="example"><i class="z-checkbox z-blue z-large"></i></td>
  175. <td><pre class="z-text-preline"></pre></td>
  176. <td class="example"><i class="z-checkbox z-blue z-large z-active"></i></td>
  177. <td><pre class="z-text-preline"></pre></td>
  178. </tr>
  179. <tr>
  180. <td>紫色</td>
  181. <td class="example"><i class="z-checkbox z-purple z-large"></i></td>
  182. <td><pre class="z-text-preline"></pre></td>
  183. <td class="example"><i class="z-checkbox z-purple z-large z-active"></i></td>
  184. <td><pre class="z-text-preline"></pre></td>
  185. </tr>
  186. </table>
  187. <#-- 三、纯多选框样式(加大) -->
  188. <div class="tutorial title">三、纯多选框样式(加大)</div>
  189. <table class="click z-table z-bordered z-pd10">
  190. <tr bgcolor="#f5f5f5">
  191. <td width="10%">类型</td>
  192. <td width="8%">未选中</td>
  193. <td width="30%">未选中代码</td>
  194. <td width="8%">已选中</td>
  195. <td width="44%">未选中代码</td>
  196. </tr>
  197. <tr>
  198. <td>默认</td>
  199. <td class="example"><i class="z-checkbox z-xlarge"></i></td>
  200. <td><pre class="z-text-preline"></pre></td>
  201. <td class="example"><i class="z-checkbox z-xlarge z-active"></i></td>
  202. <td><pre class="z-text-preline"></pre></td>
  203. </tr>
  204. <tr>
  205. <td>红色</td>
  206. <td class="example"><i class="z-checkbox z-red z-xlarge"></i></td>
  207. <td><pre class="z-text-preline"></pre></td>
  208. <td class="example"><i class="z-checkbox z-red z-xlarge z-active"></i></td>
  209. <td><pre class="z-text-preline"></pre></td>
  210. </tr>
  211. <tr>
  212. <td>橙色</td>
  213. <td class="example"><i class="z-checkbox z-orange z-xlarge"></i></td>
  214. <td><pre class="z-text-preline"></pre></td>
  215. <td class="example"><i class="z-checkbox z-orange z-xlarge z-active"></i></td>
  216. <td><pre class="z-text-preline"></pre></td>
  217. </tr>
  218. <tr>
  219. <td>黄色</td>
  220. <td class="example"><i class="z-checkbox z-yellow z-xlarge"></i></td>
  221. <td><pre class="z-text-preline"></pre></td>
  222. <td class="example"><i class="z-checkbox z-yellow z-xlarge z-active"></i></td>
  223. <td><pre class="z-text-preline"></pre></td>
  224. </tr>
  225. <tr>
  226. <td>绿色</td>
  227. <td class="example"><i class="z-checkbox z-green z-xlarge"></i></td>
  228. <td><pre class="z-text-preline"></pre></td>
  229. <td class="example"><i class="z-checkbox z-green z-xlarge z-active"></i></td>
  230. <td><pre class="z-text-preline"></pre></td>
  231. </tr>
  232. <tr>
  233. <td>青色</td>
  234. <td class="example"><i class="z-checkbox z-cyan z-xlarge"></i></td>
  235. <td><pre class="z-text-preline"></pre></td>
  236. <td class="example"><i class="z-checkbox z-cyan z-xlarge z-active"></i></td>
  237. <td><pre class="z-text-preline"></pre></td>
  238. </tr>
  239. <tr>
  240. <td>蓝色</td>
  241. <td class="example"><i class="z-checkbox z-blue z-xlarge"></i></td>
  242. <td><pre class="z-text-preline"></pre></td>
  243. <td class="example"><i class="z-checkbox z-blue z-xlarge z-active"></i></td>
  244. <td><pre class="z-text-preline"></pre></td>
  245. </tr>
  246. <tr>
  247. <td>紫色</td>
  248. <td class="example"><i class="z-checkbox z-purple z-xlarge"></i></td>
  249. <td><pre class="z-text-preline"></pre></td>
  250. <td class="example"><i class="z-checkbox z-purple z-xlarge z-active"></i></td>
  251. <td><pre class="z-text-preline"></pre></td>
  252. </tr>
  253. </table>
  254. <#-- 四、多选框样式和多选按钮联动 -->
  255. <div class="tutorial title">四、多选框样式和多选按钮联动</div>
  256. <table class="z-table z-bordered z-pd10">
  257. <tr bgcolor="#f5f5f5">
  258. <td width="8%">类型</td>
  259. <td width="8%">未选中</td>
  260. <td width="35%">未选中代码</td>
  261. <td width="8%">已选中</td>
  262. <td width="40%">未选中代码</td>
  263. </tr>
  264. <tr>
  265. <td class="type">默认</td>
  266. <td class="example-link"><input type="checkbox" data-role="z-checkbox"></td>
  267. <td><pre class="z-text-preline"></pre></td>
  268. <td class="example-link"><input type="checkbox" data-role="z-checkbox" checked></td>
  269. <td><pre class="z-text-preline"></pre></td>
  270. </tr>
  271. <tr>
  272. <td>红色</td>
  273. <td class="example-link"><input type="checkbox" data-role="z-checkbox" style="width:16px;height:16px;" data-class="z-red"></td>
  274. <td><pre class="z-text-preline"></pre></td>
  275. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-red" checked></td>
  276. <td><pre class="z-text-preline"></pre></td>
  277. </tr>
  278. <tr>
  279. <td>橙色</td>
  280. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-orange"></td>
  281. <td><pre class="z-text-preline"></pre></td>
  282. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-orange" checked></td>
  283. <td><pre class="z-text-preline"></pre></td>
  284. </tr>
  285. <tr>
  286. <td>黄色</td>
  287. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-yellow"></td>
  288. <td><pre class="z-text-preline"></pre></td>
  289. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-yellow" checked></td>
  290. <td><pre class="z-text-preline"></pre></td>
  291. </tr>
  292. <tr>
  293. <td>绿色</td>
  294. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-green"></td>
  295. <td><pre class="z-text-preline"></pre></td>
  296. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-green" checked></td>
  297. <td><pre class="z-text-preline"></pre></td>
  298. </tr>
  299. <tr>
  300. <td>青色</td>
  301. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-cyan"></td>
  302. <td><pre class="z-text-preline"></pre></td>
  303. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-cyan" checked></td>
  304. <td><pre class="z-text-preline"></pre></td>
  305. </tr>
  306. <tr>
  307. <td>蓝色</td>
  308. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-blue"></td>
  309. <td><pre class="z-text-preline"></pre></td>
  310. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-blue" checked></td>
  311. <td><pre class="z-text-preline"></pre></td>
  312. </tr>
  313. <tr>
  314. <td>紫色</td>
  315. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-purple"></td>
  316. <td><pre class="z-text-preline"></pre></td>
  317. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-purple" checked></td>
  318. <td><pre class="z-text-preline"></pre></td>
  319. </tr>
  320. </table>
  321. <#-- 五、多选框样式和多选按钮联动和操作 -->
  322. <div class="tutorial title">五、多选框样式和多选按钮联动和操作</div>
  323. <table class="z-table z-bordered z-pd10 z-px14 left z-mg-t20">
  324. <tr bgcolor="#f5f5f5">
  325. <td width="10%">类型</td>
  326. <td width="8%">未选中</td>
  327. <td width="30%">未选中代码</td>
  328. <td width="8%">已选中</td>
  329. <td width="44%">未选中代码</td>
  330. </tr>
  331. <tr>
  332. <td>默认</td>
  333. <td class="example-link"><input type="checkbox" data-role="z-checkbox" onclick="Z.FM.doSelectCheckBox('subCheckBox', this.checked);"><br><input type="checkbox" name="subCheckBox"></td>
  334. <td><pre class="z-text-preline"></pre></td>
  335. <td class="example-link"><input type="checkbox" data-role="z-checkbox" data-class="z-red" onclick="javascript:abc('弹出我的值', this.checked);"></td>
  336. <td><pre class="z-text-preline"></pre></td>
  337. </tr>
  338. </table>
  339. <#-- 六、多选框全选取消 -->
  340. <div class="tutorial title">六、多选框全选取消</div>
  341. <table class="z-table z-bordered z-pd10 z-px14 left z-mg-t20">
  342. <tr bgcolor="#f5f5f5">
  343. <td width="8%" align="center">选择</td>
  344. <td width="*">代码</td>
  345. </tr>
  346. <tr>
  347. <td class="example-link" align="center">
  348. <input type="checkbox" data-role="z-checkbox" onclick="Z.FM.doSelectCheckBox('subcb', this.checked);">
  349. <br><br><br><br>
  350. <input type="checkbox" data-role="z-checkbox" name="subcb" value="1" data-class="z-red"><br><br>
  351. <input type="checkbox" data-role="z-checkbox" name="subcb" value="2"><br><br>
  352. <input type="checkbox" data-role="z-checkbox" name="subcb" value="3" data-class="z-cyan"><br><br>
  353. <input type="checkbox" data-role="z-checkbox" name="subcb" value="4" data-class="z-blue"><br><br>
  354. </td>
  355. <td><pre class="z-text-preline"></pre></td>
  356. </tr>
  357. </table>
  358. <#-- 七、多选框全选取消反选按钮 -->
  359. <div class="tutorial title">七、多选框全选取消反选按钮</div>
  360. <table class="z-table z-bordered z-pd10 z-px14 left z-mg-t20">
  361. <tr bgcolor="#f5f5f5">
  362. <td width="20%" align="center">选择</td>
  363. <td width="*">代码</td>
  364. </tr>
  365. <tr>
  366. <td class="example-link" align="center">
  367. <button type="button" class="z-button z-blue" onclick="Z.FM.doSelectCheckBox('subcb2', 1);">全选</button>
  368. <button type="button" class="z-button z-blue" onclick="Z.FM.doSelectCheckBox('subcb2', 2);">取消</button>
  369. <button type="button" class="z-button z-blue" onclick="Z.FM.doSelectCheckBox('subcb2', 0);">反选</button>
  370. <br><br><br><br>
  371. <input type="checkbox" data-role="z-checkbox" name="subcb2" value="1" data-class="z-red"><br><br>
  372. <input type="checkbox" data-role="z-checkbox" name="subcb2" value="2"><br><br>
  373. <input type="checkbox" data-role="z-checkbox" name="subcb2" value="3" data-class="z-cyan"><br><br>
  374. <input type="checkbox" data-role="z-checkbox" name="subcb2" value="4" data-class="z-blue"><br><br>
  375. </td>
  376. <td><pre class="z-text-preline"></pre></td>
  377. </tr>
  378. </table>
  379. <#-- 八、多选框在按钮中 -->
  380. <div class="tutorial title">八、多选框在按钮中</div>
  381. <table class="z-table z-bordered z-pd10 z-px14 left z-mg-t20">
  382. <tr bgcolor="#f5f5f5">
  383. <td width="20%" align="center">选择</td>
  384. <td width="*">代码</td>
  385. </tr>
  386. <tr>
  387. <td class="example-link" align="center">
  388. <button class="z-button z-large zi-bg-white zi-mg-l10" onclick="Z(this).find('i.z-checkbox').click();">
  389. <input type="checkbox" class="display:inline-block" data-role="z-checkbox" data-class="z-blue">只设计不印刷
  390. </button>
  391. </td>
  392. <td><pre class="z-text-preline"></pre></td>
  393. </tr>
  394. </table>
  395. ${zhiqim_com_chapter()}
  396. </div>
  397. <!-- 主体结束 -->
  398. </div>
  399. <!-- 容器结束 -->
  400. </div>
  401. ${zhiqim_com_footer()}