菜鸟javascirpt问题 怎么样用javascript实现在ASP.NET 中选中两个单选按钮实现文本框的显示和隐藏 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果是js控制客户端文本框就简单.<input type="check" onclick="document.getElementById('text1').style.dispaly=this.checked?'':'none';" />隐藏<input type="text" id="text1" />如果是控制服务器端textboxdefault.aspx<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title></title> <script> function tst(obj) { //像上面的写法,不写function,直接写到checkbox的onclick事件里也一样. document.getElementById("<%=txtClientStr%>").style.display=obj.checked?"none":""; }</script></head><body> <form id="form1" runat="server"> <div> <input type="checkbox" onclick="tst(this)" /><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></div> </form></body></html>default.aspx.cspublic partial class _Default : System.Web.UI.Page { public string txtClientStr; protected void Page_Load(object sender, EventArgs e) { this.txtClientStr = TextBox1.ClientID; }} community server 源码是如何用的啊 请高手帮忙做几题面试题。。 “无法删除尚未附加的实体”的问题 如何让DataList中显示数据库中text字段的内容。 利用WebService下载服务器图片不是原图。 Web动态TabPage[求助高手] 如何在客戶端輸入一段url將服務器的ie打開 並開啟所輸入的url地址? 关于js控制css的简单问题 不能运行调试ASP.net! 出错 ExecuteNonQuery 要求已打开且可用的连接。连接的当前状态为已关闭 无法下载DLL文件 急啊~各位老大帮忙看看这个问题吧....虽然很低级......但是实在把我搞不明白了
<input type="check" onclick="document.getElementById('text1').style.dispaly=this.checked?'':'none';" />隐藏
<input type="text" id="text1" />如果是控制服务器端textbox
default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script>
function tst(obj)
{
//像上面的写法,不写function,直接写到checkbox的onclick事件里也一样.
document.getElementById("<%=txtClientStr%>").style.display=obj.checked?"none":"";
}</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="checkbox" onclick="tst(this)" /><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></div>
</form>
</body>
</html>
default.aspx.cs
public partial class _Default : System.Web.UI.Page
{
public string txtClientStr;
protected void Page_Load(object sender, EventArgs e)
{
this.txtClientStr = TextBox1.ClientID;
}
}