日期:2014-05-18  浏览次数:20446 次

点击单选按钮时控制另外的控件的显示和隐藏
我想在点击单选按钮时,控制另外的控件的显示和隐藏,还有选择要不刷新页面的,好像是要用ajax,我不会用ajax,希望哪位朋友能帮忙给出代码,谢谢

------解决方案--------------------
就用按钮不是很好


<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> 无标题页 </title>
<script type= "text/javascript ">
function show()
{
var oDiv = document.getElementById( 'div1 ');
oDiv.style.display = (oDiv.style.display== 'none ') ? 'block ' : 'none ';
return false;
}

</script>
</head>
<body>
<form id= "form1 " runat= "server ">
<asp:Button ID= "Button1 " runat= "server " Text= "Button " OnClientClick= "return show(); " />
<div id= "div1 ">
<asp:TextBox ID= "TextBox1 " runat= "server "> </asp:TextBox>
<br />
<asp:TextBox ID= "TextBox2 " runat= "server "> </asp:TextBox>
</div>
</form>
</body>
</html>
------解决方案--------------------
把另外的控件的visible属性设成False就行了啊