php 实现其中的单选按钮控制文本框的显示与隐藏

本文通过一个简单的HTML表单与jQuery结合的例子展示了如何根据用户的选择动态控制表单元素的显示与隐藏。该示例使用了jQuery库来简化DOM操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


<html>
	<head> 
	</head>
	<body>
	<table cellspacing="1" cellpadding="6" class="tb">
		<tr>
			<td class="tl"><span color="f_red">选择类型</span></td>
			<td class="tr"><input type="radio" name="istype" value="1" /> 隐藏    <input type="radio" name="istype" value="0" checked /> 显示  </td>
		</tr>
		<tr id="333">
			<td class="tl"><span color="f_red">bb</span></td>
			<td class="tr"><input type="text" size="40" name="appid" id="appid" value=""/></td>
		</tr>
		<tr id="444">
			<td class="tl"><span color="f_red">cc</span></td>
			<td class="tr"><input type="text" size="40" name="appsecret" id="appsecret" value=""/></td>
		</tr>
	</table>
	</body>
</html>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
	<script type="text/javascript">
	$(function(){
		$("input[name=istype]").click(function(){
			var type=$(this).val();
			if(type=='1'){
				$("#333").hide();
				$("#444").hide();
			}else{ 
				$("#333").show();
				$("#444").show();
			}	
		});
	})	
	</script>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值