如何使用 JavaScript 在 LinkButton 模式下触发 BulletedList?
我在 asp.net 中有一个 BulletedList 设置为 DisplayMode="LinkButton"。 我想从 javascript 触发第一个“子弹”,可以这样做吗? 如果是这样,怎么办?
I have a BulletedList in asp.net that is set to DisplayMode="LinkButton". I would like to trigger the first "bullet" from a javascript, can this be done? And if so, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设您的 BulletedList 为
...那么您可以像这样触发“onclick”事件(跨浏览器):
Say you have the BulletedList as
... then you can fire the "onclick" event like this (cross-browser):
与 Alexander 指出的类似,只是您可以使用 jQuery 来触发事件并依赖它们的跨浏览器支持,而不是自己维护它。
Similar to what Alexander indicated except that you could use jQuery to fire the event and depend on their cross-browser support rather than maintain it on your own.
经过大量测试后,似乎唯一依赖的方法是手动触发 __doPostBack-script ,如下所示:
如 所建议的亚历山大·乔舍夫
After a lot of testing it seems the only dependent way to do this is by manually firing the __doPostBack-script like so:
as suggested by Alexander Gyoshev