简体   繁体   中英

InnerHTML not working in IE

I'm using Javascript to embed a video into a webpage, using innerHTML, when the viewer is either in Australia or New Zealand. I've got the script to work in all browsers, but for some reason it is not working in any version of IE.

Here is the Javascript code im using:

<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> 

Here is the HTML

   <div id="tvc"> 
  <div id="tvcontent"></div>  
   </div>

Any body got any idea why it wouldn't work in IE?

You might have to use the <object> tag.

see here for reference.

It's probably a doctype problem. Try defining a doctype on the webpage.

The <EMBED> tag can also be used to add a SWF file to a web page, but it is an older tag and now obsolete.

IE requires object tag and not the embed tag.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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