87,990
社区成员
发帖
与我相关
我的任务
分享
<tr>
<td>
证件类型:<select name="identType" id="identType" disabled="ture">
<option value="0" selected="true">身份证</option>
<option value="1">士兵证</option>
</select>
</td>
</tr>
<tr>
<td>
证件号:<input type="input" name="identNo" id="identNo" disabled="ture"/>
</td>
</tr>
<tr>
<td>
用户名:<input type="input" name="userName" id="userName" disabled="ture"/>
</td>
</tr>function showHideIdent(){
var checkb = document.getElementsByName("allRealName");
if(checkb[0].checked){
$('#identType').disabled="true";
$('#identNo').disabled="true";
$('#userName').disabled="true";
}else{
$('#identType').disabled="flase";
$('#identNo').disabled="flase";
$('#userName').disabled="flase";
}
}
<tr>
<td>
全实名<input type="checkbox" name="allRealName" />
证件类型:<select name="identType" id="identType" disabled="true">
<option value="0" selected="true">身份证</option>
<option value="1">士兵证</option>
</select>
</td>
</tr>
<tr>
<td>
证件号:<input type="input" name="identNo" id="identNo" disabled="true"/>
</td>
</tr>
<tr>
<td>
用户名:<input type="input" name="userName" id="userName" disabled="true"/>
</td>
</tr>
<script>
function $(o){return document.getElementById(o)}
var checkb = document.getElementsByName("allRealName");
checkb[0].onclick = function(){
if(this.checked){
$('identType').disabled="";
$('identNo').disabled="";
$('userName').disabled="";
}else{
$('identType').disabled="true";
$('identNo').disabled="true";
$('userName').disabled="true";
}
}
</script>
function showHideIdent(){
$("#identType,#identNo,#userName").disabled = $("input[name='allRealName']").checked;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(function () {
$('#allRealName').change(function () {
$('.mark_select input,.mark_select select').attr('disabled', !$(this).attr('checked'));
});
});
</script>
</head>
<body>
<table>
<tr>
<td>
<input type="checkbox" name="allRealName" id="allRealName"/>全实名?
</td>
</tr>
<tr class="mark_select">
<td>
证件类型:<select name="identType" id="identType" disabled="ture">
<option value="0" selected="true">身份证</option>
<option value="1">士兵证</option>
</select>
</td>
</tr>
<tr class="mark_select">
<td>
证件号:<input type="input" name="identNo" id="identNo" disabled="ture"/>
</td>
</tr>
<tr class="mark_select">
<td>
用户名:<input type="input" name="userName" id="userName" disabled="ture"/>
</td>
</tr>
</table>
</body>
</html>