我需要将<object>
标签添加到 HTML。它在除 IE 之外的所有浏览器中都能正常工作,这会引发很多错误,例如:
- 语法错误:应为 ']'
- 错误:参数无效。
- TypeError: 'currentStyle' 为 null 或不是对象(这是当我尝试只创建
<object>
没有参数的纯文本时)
我的代码是:
jQuery('<object/>').attr('type', 'application/x-fb-vlc').append([
jQuery('<param/>').attr({'name': 'windowless', 'value': 'true'}),
jQuery('<param/>').attr({'name': 'autoplay', 'value': 'true'}),
jQuery('<param/>').attr({'name': 'bgcolor', 'value': '#999999'}),
jQuery('<param/>').attr({'name': 'network-caching', 'value': '1000'}),
jQuery('<param/>').attr({'name': 'adjust-filter', 'value': 'true'}),
jQuery('<param/>').attr({'name': 'marquee-filter', 'value': 'true'}),
jQuery('<param/>').attr({'name': 'logo-filter', 'value': 'true'}),
jQuery('<param/>').attr({'name': 'native-scaling', 'value': 'true'}),
jQuery('<param/>').attr({
'name': 'src',
'value': 'http://' + response.server + '&_=' + (new Date().getTime())
})
]).appendTo(camera_div);
我还尝试了其他方法,例如append
等等。
除了纯 HTML 之外,是否有任何解决方案可以添加此内容?