javascript detect element as null or undefine
Hi, I have the following script in the bottom of my page:
Code:
<script type="text/javascript">
if (navigator.appName.indexOf('Microsoft Internet Explorer')!=-1){
document.getElementById("fm_banner-diyur-plus1_704354692").style.top="81px";
}
</script>
I also have an object with the exact id, before this line of code:
Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="fm_banner-diyur-plus1_704354692"
class="flashmovie"
width="673"
height="138">
<param name="movie" value="http://barzilaymor.co.il/diur-plus.co.il/wp-content/uploads/2012/03/banner-diyur-plus1.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash"
data="http://barzilaymor.co.il/diur-plus.co.il/wp-content/uploads/2012/03/banner-diyur-plus1.swf"
name="fm_banner-diyur-plus1_704354692"
width="673"
height="138">
<!--<![endif]-->
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
And this code is before the script.
Yet when I load the page:
http://barzilaymor.co.il/diur-plus.co.il/
When I load it in IE 9 I get following message:
Quote:
SCRIPT5007: Unable to get value of the property 'style': object is null or undefined
diur-plus.co.il, line 487 character 3
How come?
After all I do have an element with the id of fm_banner-diyur-plus1_704354692?
and why would it have an style property?
After all, all element have supposed to have style property?