救命啊!选择radio的时候怎么响应不同的东西 我有两个radio,下面有动态增加行内容的一个表格。我想做的效果是:当我选中其中一个的时候,只显示跟这个radio有关的内容,应该怎么弄? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 onClick = "alert(this.value)" 忘了贴了: <input type="radio" id="kind0" name="kind" value="0" /> 收入 <input type="radio" id="kind1" name="kind" value="1" /> 支出 <table bgcolor="#eeeeff" width="60%" border="1"> <tr> <th width="15%"> 序号 </th> <th width="20%"> 收支类型 </th> <th width="25%"> 类型名称 </th> <th width="30%"> 备注 </th> <th width="10%"> </th> </tr> <c:forEach items="${type}" var="item" varStatus="s"> <tr class="kind${item.kind }"> <td width="15%" align="center"> ${s.count} </td> <td width="20%" align="center"> <c:choose> <c:when test="${item.kind==0}"> 收入 </c:when> <c:otherwise> 支出 </c:otherwise> </c:choose> </td> <td width="25%" align="center"> ${item.typeName} </td> <td width="30%" align="center"> <c:choose> <c:when test="${empty item.re}"> 无 </c:when> <c:otherwise> ${item.re } </c:otherwise> </c:choose> </td> <td width="10%" align="center"> <a href="deleteType?id=${item.typeId }" onclick="return confirm('确定删除?')">删除</a> </td> </tr> </c:forEach> </table>再帮我看看 <input type="radio" id="kind0" name="kind" value="0" onclick="document.forms[0].submit();" /> 收入 <input type="radio" id="kind1" name="kind" value="1" onclick="document.forms[0].submit(); /> 支出 <table bgcolor="#eeeeff" width="60%" border="1"> 这容易啊,加两个<span>:<script>function aaa(n){ var o1=document.getElementsByName(''cainiao0); var o2=document.getElementsByName(''cainiao1); o1.style.display=n==0?"":"none"; o2.style.display=n==0?"none":"";}</script><input type="radio" id="kind0" name="kind" value="0" onclick="aaa(this.value);" />收入<input type="radio" id="kind1" name="kind" value="1" onclick="aaa(this.value);" />支出。 <tr><td><span name='cainiao0' style="display:''"></span><span name='cainiao1' style="display:'none'"></span></td></tr>............ 或者,也可以在window.onload()里AJAX回来全部数据,组成JSON,再写到相应的<td></td>里。加上刷新,三种方法都可以 【分享】JavaScript版变速齿轮(纯JS/CSS实现) 如何遍历获取table内的tr的属性 jquery插入第一个元素? window.open()打开的窗口如何捕捉它的关闭事件? 小问题,路过的朋友帮忙看下 关于input位数的问题 怎么实现这种效果 奇怪这段代码总出“'return'语句在函数之外”的错误 请教大家:复制链接问题 JavaScript关于STYLE的问题 javascript脚本怎么一直循环图片? mozilla浏览器无法读取xml文件
忘了贴了:
<input type="radio" id="kind0" name="kind" value="0" />
收入
<input type="radio" id="kind1" name="kind" value="1" />
支出
<table bgcolor="#eeeeff" width="60%" border="1">
<tr>
<th width="15%">
序号
</th>
<th width="20%">
收支类型
</th>
<th width="25%">
类型名称
</th>
<th width="30%">
备注
</th>
<th width="10%">
</th>
</tr> <c:forEach items="${type}" var="item" varStatus="s">
<tr class="kind${item.kind }">
<td width="15%" align="center">
${s.count}
</td>
<td width="20%" align="center">
<c:choose>
<c:when test="${item.kind==0}">
收入
</c:when>
<c:otherwise>
支出
</c:otherwise>
</c:choose>
</td>
<td width="25%" align="center">
${item.typeName}
</td>
<td width="30%" align="center">
<c:choose>
<c:when test="${empty item.re}">
无
</c:when>
<c:otherwise>
${item.re }
</c:otherwise>
</c:choose>
</td>
<td width="10%" align="center">
<a href="deleteType?id=${item.typeId }"
onclick="return confirm('确定删除?')">删除</a>
</td>
</tr>
</c:forEach> </table>再帮我看看
收入
<input type="radio" id="kind1" name="kind" value="1" onclick="document.forms[0].submit(); />
支出
<table bgcolor="#eeeeff" width="60%" border="1">
这容易啊,加两个<span>:
<script>
function aaa(n){
var o1=document.getElementsByName(''cainiao0);
var o2=document.getElementsByName(''cainiao1);
o1.style.display=n==0?"":"none";
o2.style.display=n==0?"none":"";
}
</script>
<input type="radio" id="kind0" name="kind" value="0" onclick="aaa(this.value);" />收入
<input type="radio" id="kind1" name="kind" value="1" onclick="aaa(this.value);" />支出
。
<tr><td><span name='cainiao0' style="display:''"></span><span name='cainiao1' style="display:'none'"></span></td></tr>
............