解决方案 »
- validationEngine验证控件如何取消验证?
- 急,js问题
- javascript ocx 事件 怎样封装到js脚本中!
- 大家快来看看,这个怎么实现
- Firefox开发。
- 特急,在线等,想做一个下压式的整屏广告,然后自动关闭,像新浪那样的
- 怎樣動態改變TABLE的datasrc的兩個問題
- 紧急问题
- wshshell.sendkeys不支持中文啊,如果我要写中文字符串,该怎么处理?
- 一直在纠结怎么去删除IE中的监听函数,希望各位帮个忙,谢谢
- Extjs4.2 使用 RowEditing 编辑,怎么实现当一个文本框值改变时,另一个也改变
- 自学《javascript高级程序设计》持续更新,请大家监督
$(':checkbox').change(function(){$(this).parents('tr').find('div.username')[this.checked?'show':'hide']()})
<script>
$(function() {
$('.user_resource .username').hide();
$('.user_resource :checkbox').click(function() {
if($(this).prop('checked')) $(this).parents('tr').find('.username').show();
else $(this).parents('tr').find('.username').hide();
});
})
</script>
<div class="user_resource">
<table width="100%" >
<tr height="90px">
<td width="7%" align="center">
<input type="checkbox"/>
</td>
<td width="30%" align="center">人力资源管理系统</td>
<td width="19%" align="center">
<img src="images/13.png">
</td>
<td width="44%" align="center">
<div class="username">用户名:<input type="text" name="appUserName" id="appUserName"/></div>
</td>
</tr>
</table>
</div>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.username{ border:#F00 1px solid; width:200px; height:300px;}
</style>
</head>
<body>
<script src="jquery-1.9.0.js"></script>
<script>
$(function(){
$(':checkbox').click(function(){
if($(this).prop('checked')){
$(this).parents('tr').find("div").addClass("username");
}else{
$(this).parents('tr').find("div").removeClass("username");
}
});
})
</script>
<div class="user_resource">
<table width="100%" >
<tr height="90px">
<td width="7%" align="center">
<input type="checkbox"/>
</td>
<td width="30%" align="center">人力资源管理系统</td>
<td width="19%" align="center">
<img src="images/13.png">
</td>
<td width="44%" align="center">
<div>用户名:<input type="text" name="appUserName" id="appUserName"/></div>
</td>
</tr>
</table>
</div>
</body>
</html>
$('.user_resource .username').hide();
$('.user_resource :checkbox').click(function() {
if($(this).prop('checked')) $(this).parents('tr').find('.username').show();
else {
$(this).parents('tr').find('.username').hide();
$(this).parents('tr').find('#appUserName').val('');
}
});
})