c# webform下有几十个button,button.id值存在变量里面,怎样才能通过变量值直接找到相应的button,并给button置属性.
如变量b1="bok",webform下有个button,button.id="b0k"
怎么通过b1值直接找到该button?
有几十个button!!
如变量b1="bok",webform下有个button,button.id="b0k"
怎么通过b1值直接找到该button?
有几十个button!!
呵呵,是楼上的一位
function SetButtonAttribute(var b1)
{
var buttonName=null;
if buttonName=document.getElementByID(b1);
buttonName.value="the name of the button";
...其他同理
如果你的名字很有规律可以考虑使用循环
//var textBoxs = document.getElementsByTagName("button");这里 返回button的记录集}
</script>
getElementByID(b1)--Javascript
copico(路北) ( )的这个方法
Button bt = (Button)this.Page.FindControl(id)
不扎实.大家都有分.谢谢大家.