开发者

create flash by javascript

I have this code, but doesn't work.

HTML block:

  <div id="div_container"></div>

JS

 var youtube_code = '<object width="434" height="309"><param name="movie" value="http://www.youtube-nocookie.com/v/NWHfY_lvKIQ&hl=es_AR&fs=1?rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/NWHfY_lvKIQ&hl=es_AR&fs=1?rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="434" height="309"></embed></object>';
  document.getElementById('div_container').innerHTML = youtube_code开发者_运维百科;

I really don't understand why. I'd tried it in all browsers(IE, FF, CHR,O). Not js errors happens. I can see in firebug or inspector that object node is created. But Flash plugin never appear.

Thanks


Recommend: use a well established, tried and tested js library like swfobject instead.


Try this:


<html>
<head>
</head>
<script>
var youtube_code = '<object width="434" height="309">'+
'<param name="movie" value="http://www.youtube-nocookie.com/v/NWHfY_lvKIQ&hl=es_AR&fs=1?rel=0" />'+
'<param name="allowFullScreen" value="true" />'+
'<param name="allowscriptaccess" value="always" />'+
'<embed src="http://www.youtube-nocookie.com/v/NWHfY_lvKIQ&hl=es_AR&fs=1?rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="434" height="309">'+
'</embed>'+
'</object>';
var writeIt = function() {
    document.getElementById('div_container').innerHTML = youtube_code;
};
</script>
<body onLoad="writeIt();">
<div id="div_container"></div>
</body>
</html>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜