当观众在澳大利亚或新西兰时,我正在使用 Javascript 使用 innerHTML 将视频嵌入到网页中。我的脚本可以在所有浏览器中运行,但由于某种原因,它不能在任何版本的 IE 中运行。
这是我使用的 Javascript 代码:
<script type="text/javascript">
var countryName = geoip_country_name();
var boxbaby = document.getElementById('tvc');
var video = "<embed type='application/x-shockwave-flash' src='../htm/summer-tvc/player.swf' id='summertvc' width='452' height='255' flashvars='skin=../htm/summer-tvc/skins/mySkin.swf&thumbnail=../htm/summer-tvc/thumbnail.jpg&video=http://f4player.googlecode.com/files/inhibited-island.mp4' allowscriptaccess='always' allowfullscreen='true' bgcolor='#000000' />";
if (countryName == "Australia" || countryName == "New Zealand") {
document.getElementById('tvcontent').innerHTML = video;
} else {
document.getElementById('tvcontent').innerHTML = "<img src='../images/pages/summer-tvc/tvc-outside-area.jpg' alt='Due to legal restrictions you are unable to view this video as your IP address is registered outside of Australia and New Zealand. We apologise for the inconvenience.'/>";
};
</script>
这是HTML
<div id="tvc">
<div id="tvcontent"></div>
</div>
任何人都知道为什么它在 IE 中不起作用?