var flashElements = document.getElementsByTagName(“EMBED”); 的最佳替代品
我想在随机页面上找到所有 Flash 对象(使它们 wmode=透明,这样它们就不会隐藏菜单)。
IE 不支持 EMBED: document.getElementsByTagName("EMBED");
知道什么是最有效地找到所有嵌入(没有 jQuery...)
另外对于更高级的:我遇到了嵌入标记被编写为 eMBED 的网站。 我还需要找到这些类型的标签。
谢谢
I want to find all flash objects on a random page (to make them wmode=transparent so they wont hide a menu).
IE does not support EMBED in: document.getElementsByTagName("EMBED");
Any idea what is the most efficent to find all embeds (no jQuery...)
Also for the more advanced: I came across sites where the embed tag was written as eMBED. I need to find these kind of tags also.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题不在于 IE 不支持
事实上,这是首选语法,并且 swfobject 也使用这个。 因此,对于跨浏览器解决方案,您需要查找:
我不确定 Opera 或 Safari 等其他浏览器,您可能需要使用更多变体来扩展此列表。
使用 jQuery 或原型等 javascript 库查找这些元素应该是微不足道的,但您可以在没有这些的情况下进行管理。
I think the problem is not that IE does not support a search on <embed> tags but rather that in IE one uses <object> tags to include a flash element. As a matter of fact, Firefox also supports the latter format, if you use the following form:
In fact, this is the preferred syntax, and swfobject uses this as well. So, for a cross-browser solution, you'd need to look for:
type
attribute set to "application/x-shockwave-flash"classid
attribute set to "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"Im unsure about other browsers like Opera or Safari, it is possible that you need to extend this list with further variants.
Finding these elements should be trivial with a javascript library like jQuery or prototype, but you can manage without those.