获取 javascript 函数中 asp.button 函数的属性
我想知道如何从 javascript 函数获取 asp:Button 的属性。
具体来说,我希望能够测试 javascript 函数中是否启用了特定的 aspx 按钮。
I would like to know how I can get the properties of an asp:Button from a javascript function.
Specifically I want to be able to test whether a specific aspx button is enabled or not in a javascript function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一旦知道
的客户端 ID,您就可以使用document.getElementById
函数来获取其 DOM 对象的引用并获取您想要的其他属性。有兴趣.示例:
aspx 标记中的某些位置:
在 javascript 中:
Once you know the client ID of the
<asp:Button />
you can usedocument.getElementById
function to get the reference of it's DOM object and get other properties you are interested in.An example:
Some where in aspx mark up:
In javascript:
您可以像使用纯 html 按钮一样执行此操作。
变成
如果您使用的是新版本的asp.net,您可以添加ClientIDMode =“Static”,这样id就不会更改为其他内容。
You do this like you would with a plain html button.
Turns into
If youre using a new version of asp.net, you can add ClientIDMode="Static" so that the id doesnt change to something else.