gpt4 book ai didi

javascript - 跨浏览器检测 JavaScript 中的 Flash "Click"事件

转载 作者:行者123 更新时间:2023-11-30 08:17:09 25 4
gpt4 key购买 nike

JavaScript 有没有办法检测 Flash 对象上发生的点击(或鼠标按下、鼠标弹起)?

我试过:

  • 使用 attachEvent/addEventListener 将“mouseup”、“mousedown”和“click”事件附加到 Flash 对象
  • 在 Flash 对象上直接附加内联的 'onmouseup'、'onmousedown'、'onclick' 事件
  • 从事件“冒泡”切换到事件“捕获”(仅适用于 Firefox/Safari)

我需要它在 IE6+、Firefox 2+ 和 Safari 3+ 中工作。

感谢您的帮助! -戴夫

最佳答案

我在 http://progproblems.blogspot.com/2009/08/javascript-onclick-for-flash-embeded.html 找到了这个

1) Set the param wmode to transparent. This allows the object containing the flash to receive the javascript onclick.
2) Use onmousedown insted of onclick. In spite of using wmode transparent, some browsers still wont call the onclick, but they do call onmousedown.
The code looks like this:

<div onmousedown="clickBanner(1)">
<object>
<param name="movie" value="3.swf">
<param name="wmode" value="transparent" />
<embed wmode=transparent allowfullscreen="true" allowscriptaccess="always" src="3.swf"></embed>
</object>
</div>

它能满足我的需要 =)

关于javascript - 跨浏览器检测 JavaScript 中的 Flash "Click"事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1159548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com