我有个是否的RadioButtonList点是后旁边出现输入框输入内容。点否隐藏。

解决方案 »

  1.   

    用javascript 
    给RadioButtonList加上onclick事件你说得太含糊 所以没办法给你写代码
      

  2.   

    是用JS啊。但他生成的HTML是xx_0,xx_1这样的ID.ONCLICK事件放在了外围的SPAN标签上了。就不知道怎么写了。
      

  3.   

    RadioButtonList1.Items[0].Attributes.Add("onclick","document.getElementById('TextBox1').style.display='none'");
                    RadioButtonList1.Items[1].Attributes.Add("onclick", "document.getElementById('TextBox1').style.display=''");
      

  4.   

    thank u RadioButtonList有个BUG就是不能把脚本加到项上,看输出。以前貌似看到过有个什么解决办法的。CS:
    c31.Attributes.Add("onClick", "tell1(this)");
    c31.Items[1].Attributes.Add("onClick", "tell(this)");THML:
    <span id="c31" onClick="tell1(this)"><input id="c31_0" type="radio" name="c31" value="好" checked="checked" /><label for="c31_0">好</label><input id="c31_1" type="radio" name="c31" value="较好" /><label for="c31_1">较好</label><input id="c31_2" type="radio" name="c31" value="一般" /><label for="c31_2">一般</label><input id="c31_3" type="radio" name="c31" value="差" /><label for="c31_3">差</label></span>
      

  5.   

    <script language="javascript" type="text/javascript">
            function SetVisible()
            {
                var txt = document.getElementById("TextBox1");
                var rbl = document.getElementsByName("RadioButtonList1");            
                for(var i =1;i<rbl.length;i++)
                {
                    if(rbl[i].checked && rbl[i].value=="1")
                    {
                        txt.style.visibility = "visible";                    
                    }
                    if(rbl[i].checked && rbl[i].value=="0")
                    {
                        txt.style.visibility = "hidden";                    
                    }
                }
            }
        </script>  
    <asp:RadioButtonList ID="RadioButtonList1" runat="server" onclick="SetVisible()" RepeatDirection="Horizontal">
                <asp:ListItem Value="1">是</asp:ListItem>
                <asp:ListItem Value="0">否</asp:ListItem>
            </asp:RadioButtonList>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>