document.getElementById('id').value failing in ASP.net javascript function

随声附和 提交于 2019-11-30 13:13:28

When you place runat="server" in an standard HTML tag, ASP.Net mangles the ID to ensure that it's unique (just like it does with its own controls). You need to access the element using the ID that ASP.Net assigned. Try this:

var brk = document.getElementById('<%= hidBT.ClientID %>').value;
var org = document.getElementById('<%= hidOrg1.ClientID %>').value;

Additional Information

If you're using the 4.0 framework, you can change this behavior at the element, page, or application level. Check out this link for a decent little tutorial. If you choose to set the ClientIdMode to Static, you can access your elements by the ID's that you originally assigned (they will not be changed).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!