我使用 swfobject 为 Youtube 视频开发了一个加载器。使用的插件:jQuery 1.6.4 + SWFobject 2.2
在 IE8 上一切正常!它在 script.innerHTML 处崩溃...
<div id"youtube"><div id="player"></div></div>
脚本
function loadYoutube(videoID)
{
var script = document.createElement("script");
script.type = "text/javascript";
document.getElementById("youtube").appendChild(script);
script.innerHTML = 'var params = { allowScriptAccess: "always", wmode: "transparent", allowfullscreen:"true" }; var atts = { id: "player" }; swfobject.embedSWF("http://www.youtube.com/v/'+videoID+'?enablejsapi=1&playerapiid=ytplayer&version=3", "player", "870", "550", "8", "flash/expressInstall.swf", null, params, atts);';
}
loadYoutube('BoEKWtgJQAU');
有任何想法吗 ?谢谢