您的位置:首页 > Web前端 > JavaScript

js 全选

2015-08-21 15:15 459 查看
 <pre name="code" class="javascript"><td height="35"><span class="STYLE4">
全选  <input type="checkbox" id="allcheck" value="全选" onchange="checkall()" /><br/>
</span>
</td>
height="35" align="center" valign="middle">
<input type="checkbox" name="serial" id="serial" varlue="${queryVo.serialCode }">
</td>
function checkall(){
var ischeck = $("input[id='allcheck']").is(':checked');
var ids=$("input[name='serial']");
for(var i=0;i<ids.length;i++){
ids[i].checked=ischeck;
}
}



</pre> //获取选中的值<br />  $(document).ready(function() {<br /><span style="white-space:pre">		</span> $("#print").click(function(){<br /><span style="white-space:pre">			</span> var chk_value =[]; <br /><span style="white-space:pre">			</span> $('input[name="serial"]:checked').each(function(){ <br /><span style="white-space:pre">			</span>      chk_value.push($(this).val()); <br /><span style="white-space:pre">			</span> }); <br /><span style="white-space:pre">			</span> alert(chk_value.length==0 ?'你还没有选择任何内容!':chk_value); <br /><span style="white-space:pre">		</span> <br /><span style="white-space:pre">		</span> });<br /><span style="white-space:pre">	</span>});<pre name="code" class="html">
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: