標籤:style blog io 使用 java ar for 資料 2014
<html> <head> <script src="jquery-1.7.2.min.js"></script> <script src="jquery.easyui.min.js" ></script> <link rel="stylesheet" href="css/themes/metro/easyui.css" ></link> <link rel="stylesheet" href="css/themes/icon.css" ></link> </head> <body> <form class="ui-forms p20" > <input type="text" id="ysvalue" > <fieldset> <legend>反作弊資料匯出</legend> <div class="pt20"> <table> <tr> <td><label style="float: none">團單 </label> <input type="text" id="byJobName" name="byJobName" value="" size="20" ></td> <td><input type="checkbox" id="byJobName" name="byJobName" value="" size="20" >只看黑名單團單</td> </tr> <tr> <td><label style="float: none">訂單ID</label> <input type="text" id="byJobClass" name="byJobClass" value="" size="20" ></td> <td><label style="float: none">券碼ID</label> <input type="text" id="byJobClass" name="byJobClass" value="" size="20" ></td> </tr> <tr> <td><label style="float: none">預算</label> <select id="cc" style="width:150px"></select><span style="white-space:pre"></span> <div id="sp"><span style="white-space:pre"></span> <input type="checkbox" id="ysqu" value="01" onclick="ysqx();"><span>全選</span><br/><span style="white-space:pre"></span> <input type="checkbox" id="lang" value="01"><span>Java</span><br/><span style="white-space:pre"></span> <input type="checkbox" id="lang" value="02"><span>C#</span><br/><span style="white-space:pre"></span> <input type="checkbox" id="lang" value="03"><span>Ruby</span><br/><span style="white-space:pre"></span> <input type="checkbox" id="lang" value="04"><span>Basic</span><br/><span style="white-space:pre"></span> <input type="checkbox" id="lang" value="05"><span>Fortran</span><span style="white-space:pre"></span> </div> </td> <td> </td> <td><button type="button" class="ui-button-red ui-button ui-widget ui-Status-default ui-corner-all ui-button-text-only" onclick="search();" > 查 詢 </button> <button type="button" id="btnReset" name="btnReset" class="ui-button-red ui-button ui-widget ui-Status-default ui-corner-all ui-button-text-only" > 重 置 </button> </td> </tr></table> </div> </fieldset> </form> <body></html><script type="text/javascript">// ready後把複選框列表載入到對應的select組裡$(function(){ $('#cc').combo({required:true,editable:false}); $('#sp').appendTo($('#cc').combo('panel')); $('#sp input').click(function(){ var s = ""; if ($(this).attr("checked")){ // 當前複選框是選中狀態 s = $(this).next('span').text(); $('#cc').combo('setText', s); } else { // 當前複選框是非選中狀態,則找最近一個選中的狀態,如果沒有返回空值 for (var i=0;i<lang.length;i++ ){ if(lang[i].checked){ s = $(lang[i]).next('span').text(); break; } } $('#cc').combo('setText', s); } });});// 點擊查詢按鈕function search(){ var value = ""; for (var i=0;i<lang.length;i++ ){ if(lang[i].checked){ value=value+lang[i].value + ","; } } // 擷取所有選中的複選框的值,把值填充到一個text裡方便後面使用 ysvalue.value = value;}// 預算下拉複選框全選function ysqx(){ if (ysqu.checked) { // 選中全選,讓所有複選框選中 for (var i=0;i<lang.length;i++ ){ lang[i].checked = true; } } else { // 取消全選 for (var i=0;i<lang.length;i++ ){ lang[i].checked = false; } }}</script>
JS下拉複選框的實現