日期:2014-05-16 浏览次数:20472 次
<html> <head> <script language="JavaScript"> function check(obj){ var f = document.forms[0]; if(f.elements[obj.name][0].checked) f.elements["aa"].style.display = "block"; else f.elements["aa"].style.display = "none"; } </script> </HEAD> <BODY> <form> <table> <tr> <td> 是否显示 </td> <td> <input type="radio" name="link" value="1" checked onclick="check(this);">是 <input type="radio" name="link" value="0" onclick="check(this);">否 </td> </tr> <tr> <td> 地址 </td> <td> <input type="text" name="title0" class="InputStyle_1"> </td> </tr> <tr > <td> 内容 </td> <td> <input type="text" name="aa" class="InputStyle_1"> </td> </tr> </table> </form> </BODY> </HTML>
------解决方案--------------------
<table>
<tr>
<td>
是否显示 </td>
<td><input type="radio" name="link" value="1" onclick="change(this)">是 <input type="radio"
name="link" value="0" onclick="change(this)">否
</td>
</tr>
<tr>
<td>
地址 </td>
<td> <input type="text" name="title0"> </td>
</tr>
<tr >
<td>
内容
</td>
<td>
<input type="text" name="aa" > </td>
</tr>
</table>
<script language=javascript>
function change(obj)
{
if(obj.checked&&obj.value==0)
document.all.aa.parentNode.style.visibility="hidden";
else
if(obj.checked&&obj.value==1)
document.all.aa.parentNode.style.visibility="visible";
}
</script>