JQuery控制input的隐藏和显示

radio:

<tr>
                    <th class="red">选择类型:</th>
                    <td colspan="3">
   						
                     	<input name="strAppliType" type="radio" value="01" οnclick="display(this.value)" checked>出差  
                     	<input name="strAppliType" type="radio" value="03" οnclick="display(this.value)" >脱产学习  </br>
                     	<input name="strAppliType" type="radio" value="04" οnclick="display(this.value)" >事假  
                     	<input name="strAppliType" type="radio" value="05" οnclick="display(this.value)" >病假  
                     	<input name="strAppliType" type="radio" value="06" οnclick="display(this.value)" >年休假  </br>
                     	<input name="strAppliType" type="radio" value="08" οnclick="display(this.value)" >婚假  
                     	</div>
                     	
                    </td>
                </tr>


input:

<tr id="isshow">
   				  	<th>岗  位:</th>
               		<td >
                		<input type='text'  name='strStation' id='strStation' class="text_ipt2" >
               		</td>
               		<th>工作时间:</th>
               		<td>
                		<input type='text'  name='strWorkTime' id='strWorkTime'  class="text_ipt2" > 年
               		</td>
               	</tr>


在JavaScript中通过radio的选择来控制input的显示与隐藏

//类型选择后出现请假类型
function display(n) {
	if(n==01||n==03){
		$("#isshow").find("th:eq(1)").show();
		$("#isshow").find("td:eq(1)").show();
		$("#isshow").find("td:eq(0)").attr("colspan","1");

		
	}else if(n==06){
		$("#isshow").find("td:eq(0)").attr("colspan","3");
		$("#isshow").find("th:eq(1)").hide();
		$("#isshow").find("td:eq(1)").hide();
		
	}else{ 
		$("#isshow").find("td:eq(0)").attr("colspan","3");
		$("#isshow").find("th:eq(1)").hide();
		$("#isshow").find("td:eq(1)").hide();
	} 
}

 

页面初始化时input的显示与隐藏

<script type="text/javascript">
showtable.loader('TextInput01', 'tr', 'evenOver');
$("#isshow").find("th:eq(1)").show();
$("#isshow").find("td:eq(1)").show();



 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值