如:this.txtMyName.Attributes.Add("MyID","1");
 
在客户端获取值:document.all.txtMyName.MyID或者document.all.txtMyName.Attributes["MyID"]都不成功,TextBox类型或者Input有没有除value其他的属性在客户端可以访问的?急急!!!!!!!!!!!!!!!!!

解决方案 »

  1.   

    添加style 属性
    Attribute("style","z-index:3;display:none;")客户端
    object.style.display="none"
    object.style.zIndex=3.................
    依次类推
      

  2.   

    if(document.all.txtMyName==null)
      alert('没有txtMyName这个东西');
    else
      alert(document.all.txtMyName.MyID);
      

  3.   

    在客户端写入下代码应该可以实现你的要求
    if(document.all("txtMyName").MyID == "1")
    {
    alert("Succed");
    }
    else
    {
    alert("Fail");
    }
      

  4.   

    document.getElementById("txtMyName").id
    ....
    最好不用document.all.....这个只有微软的浏览器支持,而上面的方法所有浏览器就没问题,因为DOM解析所有浏览器都是支持的....