简体   繁体   English

swfobject分配一个类-Internet Explorer错误

[英]swfobject assigning a class - internet explorer error

I have a piece of PHP code that loops through to display all the banners that are stored in a database. 我有一段PHP代码可以循环显示所有存储在数据库中的标语。 If the code detects that the banner is a swf, it embeds it like this: 如果代码检测到横幅为swf,则将其嵌入如下:

swfobject.embedSWF(\"".$banners->banner_url."\", \"flash_ad_con".$count."\", \"".$dimens['w']."\", \"".$dimens['h']."\", \"9.0.0\", false, false, false, {class: 'flash_ad_con'});

This works fine on all browsers except any version of Internet Explorer. 在除任何版本的Internet Explorer之外的所有浏览器上,此方法都可以正常工作。 If I remove the optional attributes that I add (in this case 'class') like this: 如果我删除添加的可选属性(在本例中为“类”),如下所示:

swfobject.embedSWF(\"".$banners->banner_url."\", \"flash_ad_con".$count."\", \"".$dimens['w']."\", \"".$dimens['h']."\", \"9.0.0\", false, false, false);

It then works on Internet Explorer but obviously doesn't have the class applied and is therefore out of alignment. 然后,它可以在Internet Explorer上运行,但显然没有应用该类,因此无法对齐。 I can't set the alignment using the ID as it's dynamic and I want to avoid changing the stylesheet to PHP if possible. 我不能使用ID来设置对齐方式,因为它是动态的,并且如果可能的话,我想避免将样式表更改为PHP。

I think the reason it doesn't work in IE is that 'class' is a reserved word, but I'm using it within a JSON object so I didn't think it would be affected. 我认为它在IE中不起作用的原因是“类”是保留字,但是我在JSON对象中使用它,因此我认为它不会受到影响。

Does anyone have any workarounds or alternate ways of doing this? 有人有任何解决方法或替代方法吗? I would add it inline but as the DOM elements are being created at runtime, I can't really. 我会内联添加它,但是由于DOM元素是在运行时创建的,所以我不能。

Thanks 谢谢

Found the solution - using 'styleclass' instead of 'class' in the JSON object works across browsers. 找到了解决方案-在跨浏览器的JSON对象中使用“ styleclass”而不是“ class”。 I couldn't find that anywhere in the official documentation, I found it under 'Issues' under their Google Code site 我在官方文档的任何地方都找不到,我在他们的Google Code网站的“问题”下找到了它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM