使用 javascript 获取 LinkButton 文本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/4406630/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get LinkButton text using javascript
提问by Fire Hand
How can i get the text of LinkButton in .NET using javascript?
如何使用 javascript 在 .NET 中获取 LinkButton 的文本?
Tried .innerHTMl, .innerText, .value...all not working....
试过 .innerHTMl, .innerText, .value...都不起作用....
采纳答案by Ghyath Serhal
document.getElementById('lnk1').innerText 
this should solve your problem, i tried it now and it works.
can you show me your code.
这应该可以解决你的问题,我现在试过了,它有效。
你能告诉我你的代码吗?
回答by sam
for server side control use ClientID.
对于服务器端控制使用 ClientID。
document.getElementById('<%= lnk1.ClientID %>').innerText
works for asp.net server side controls.
适用于 asp.net 服务器端控件。

