虽然简单,不过曾经困扰多时,还是记录一下吧。

 

来源:http://mou518.blog.163.com/blog/static/1756052222010111434428828/

 

因为经常服务器控件在运行编译后ID是变化了的,如

<asp:TextBox ID="txtName"runat="server"></asp:TextBox>

运行编译后的结果可能是

<input name="ctl00$ContentPlaceHolder1$txtName " type="text" />

 

如果直接用document . getElementById(“txtName”)是获取不了的,

要用 document. getElementById(“<%= txtName.ClientID%>”)

 

 

相关文章:http://www.cnblogs.com/sophist/archive/2011/05/19/2050731.html

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2022-03-08
  • 2021-12-10
  • 2022-02-08
  • 2022-02-26
猜你喜欢
  • 2022-02-21
  • 2022-12-23
  • 2021-09-26
  • 2021-07-10
  • 2021-09-15
  • 2021-12-21
  • 2022-12-23
相关资源
相似解决方案