用ID呀!getElementById("Guestbook1_ipt_name"').value
为了得到正确的客户端ID你可以在服务器端产生js脚本到客户端!可以使用下面的方法得到
this.YourControl.UniqueID.Replace(":","$")将:替换成$或者替换成_都可以!
为了得到正确的客户端ID你可以在服务器端产生js脚本到客户端!可以使用下面的方法得到
this.YourControl.UniqueID.Replace(":","$")将:替换成$或者替换成_都可以!
try to output the id to the client side, for exampledocument.getElementById("<%=ipt_name.ClientID%>").valueordocument.forms[0].elements["<%=ipt_name.UniqueID%>"].valueor go through the elements collectionfor (var i=0; i < document.forms[0].elements.length; i++)
{
if (document.forms[0].elements.name.indexOf("ipt_name") >= 0)
{
//you got your control
}
}
{
if (document.forms[0].elements.name.indexOf("ipt_name") >= 0)
{
//you got your control
}
}
ID和NAME最好保持一致