博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

javascript 达到设置textbox的"enable=false"状态一样的功能

Posted on 2009-02-06 11:50  hyd309  阅读(1323)  评论(0编辑  收藏  举报
RadioButton cc = new RadioButton();
        RadioButton dd = new RadioButton();
        aa.ID = "Tbx_aa";
        aa.Text = "aaaaaaa";
        bb.ID = "Tbx_bb";
        PlaceHolder1.Controls.Add(aa);
        PlaceHolder1.Controls.Add(bb);
        cc.ID = "Cbx_cc";
        cc.Text = "有效";
        cc.GroupName = "1";
        cc.Attributes.Add("onclick", "javascript:document.getElementById('Tbx_aa').disabled=false;document.getElementById('Tbx_bb').disabled=false;");
        PlaceHolder1.Controls.Add(cc);
        dd.ID = "Cbx_dd";
        dd.Text = "无效";
        dd.Checked = true;
        dd.GroupName = "1";
        dd.Attributes.Add("onclick", "javascript:document.getElementById('Tbx_aa').disabled=true;document.getElementById('Tbx_bb').disabled=true;");
        PlaceHolder1.Controls.Add(dd);