亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

求大神幫忙

求大神幫忙

qq_sU_4 2016-07-20 17:42:23
<!DOCTYPE html><html lang="en"><head> ? ?<meta charset="UTF-8"> ? ?<title>Title</title> ? ?<script src="jquery.min.js"></script></head><body><table id="setPermission" class="table marginTop_30"> ? ?<tr> ? ? ? ?<td colspan="5"> ? ? ? ? ? ?<span class="font_bold margin_X10">角色管理</span> ? ? ? ? ? ?<input type="checkbox" id="selectAllTerm"> ? ? ? ? ? ?<label for="selectAllTerm">全選</label> ? ? ? ?</td> ? ?</tr> ? ?<tr id="termRow"> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>查看學期列表</label> ? ? ? ?</td> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>添加學期</label> ? ? ? ?</td> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>修改學期</label> ? ? ? ?</td> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>刪除學期</label> ? ? ? ?</td> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>停用/啟用學期</label> ? ? ? ?</td> ? ?</tr> ? ?<tr> ? ? ? ?<td colspan="5"> ? ? ? ? ? ?<span class="font_bold margin_X10">專業管理</span> ? ? ? ? ? ?<input type="checkbox" id="selectAllSpecialty"> ? ? ? ? ? ?<label for="selectAllSpecialty">全選</label> ? ? ? ?</td> ? ?</tr> ? ?<tr id="specialtyRow"> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>查看專業列表</label> ? ? ? ?</td> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>添加專業</label> ? ? ? ?</td> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>修改專業</label> ? ? ? ?</td> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>刪除專業</label> ? ? ? ?</td> ? ? ? ?<td> ? ? ? ? ? ?<input type="checkbox"> ? ? ? ? ? ?<label>停用/啟用專業</label> ? ? ? ?</td> ? ?</tr></table><!--如果子選項取消勾選一個,全選按鈕就取消勾選;反之全選了子選項,全選按鈕默認勾選。這個功能贏該怎么寫??--><script> selectAll = function (obj) { ? ? ? ?var checklist = $(obj).parent().parent().next().find("input[type='checkbox']"); $(obj).click(function () { ? ? ? ? ? ?$(obj).parent().parent().next().find("input[type='checkbox']").prop("checked", $(obj).prop("checked")); }); } ? ?selectAll($("#selectAllTerm")); selectAll($("#selectAllSpecialty"));</script></body></html>
查看完整描述

2 回答

?
剛毅87

TA貢獻345條經驗 獲得超309個贊

<!DOCTYPE?html>
<html>
	<head>
		<meta?charset="UTF-8">
		<title></title>
	</head>
	<body>
		<input?type="button"?value="選擇"?id="btn"/>
		<input?type="checkbox"?name=""?id="check"?value=""?/>
	</body>
	<script?type="text/javascript">
		var?btn?=?document.getElementById('btn');
		var?check?=?document.getElementById('check');
		//給按鈕添加點擊事件
		btn.onclick?=?function?(){
//			alert(check.checked)
//			check.checked?的選中和非選中狀態;
//			true?選中?false?非選中
			//如果選擇框為選中狀態,且切換為非選中狀態
			if(check.checked){
				//設置非選擇雙胎
				check.checked?=?false;
			}else{
				//設置選擇狀態
				check.checked?=?true;
			}
		}?
		var?bool?=?true;
		if?(bool)?{
	????????	check.checked?=?true;
	????????	bool?=?false;
	????}?else{
	????????	check.checked?=?false;
	????????	bool?=?true;
	????}
	</script>
</html>

你參考一下吧.

查看完整回答
反對 回復 2016-07-20
  • 2 回答
  • 0 關注
  • 1511 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號