如何在 Mootools 中为具有特定元素 ID 的特定标签/元素触发事件?
如何在 Mootools 中为具有特定元素 ID 的特定标签/元素触发事件?
我有这个:
<a href="youtube-clip...etc" rel="rokbox" id="video_popup" style="display: none;">Video</a>
这个 rel="rokbox"
意味着该元素将由 Mootools RokBox 模式框使用,但我隐藏了链接。
现在,我添加了以下代码:
window.onload = function() {
if(document.readyState == 'complete') {
// point of execution
// here I want to trigger the "a" element I've wrote up before
}
}
代码到达“执行点”,此时我设置了基本警报或其他任何内容。
How to trigger an event in Mootools for a specific tag/element with a specific element ID?
I have this:
<a href="youtube-clip...etc" rel="rokbox" id="video_popup" style="display: none;">Video</a>
This rel="rokbox"
means that the element will be used by the Mootools RokBox modal box, but I've hidden the link.
Now, I've added this code:
window.onload = function() {
if(document.readyState == 'complete') {
// point of execution
// here I want to trigger the "a" element I've wrote up before
}
}
The code reaches until the "point of execution", when I set a basic alert, or whatsoever.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意使用 addEvent/domready,这是添加页面准备好后必须执行的函数的正确方法。
Note the use addEvent/domready, which is the proper method to add a function which must execute once the page is ready.