I have question why sometime javascript work properly on mozilla
but in case of Internet Explore
it not work.What the issues here
Is there any that I need to add in my javascript
Please reply if any body know.I have created a very small javascript but it nis not working on IE.
code
<script language="javascript">
function toggle(divid) {
//alert(divid);
var ele = document.getElementById("toggleText");
var text = document.getElementById(divid);
var innerhtml= document.getElementById(divid).innerHTML;
//alert(innerhtml);
if(ele.style.display == "block")
{
ele.style.display = "none";
text.innerHTML = docu开发者_运维知识库ment.getElementById(divid).innerHTML;
}
else {
ele.style.display = "block";
text.innerHTML = document.getElementById(divid).innerHTML;
}
}
</script>
<div id="container"><embed height="450" width="450" wmode="transparent" type="application/x-shockwave-flash" src="http://www.youtube.com/v/sIFYPQjYhv8&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1"></div>
<?php for($i=0;$i<=2;$i++)
{
?>
<div id="displayText<?php echo $i; ?>" onClick="javascript:toggle(this.id);"><embed height="150" width="150" wmode="transparent" type="application/x-shockwave-flash" src="http://www.youtube.com/v/sIFYPQjYhv8&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1"></div>
<div id="toggleText" style="display: none">change inner html</div>
<?php } ?>
Thanks
Well, because different browsers have different levels of compliance to Javascript specifications.
See http://sputnik.googlelabs.com/
More than likely you have errors in your java script syntax. Next time in ie push F12 then select the script tab and click start debugging. You page will refresh and it should break on your error(s)
There could be multiple reasons why some script works on one browser but not on another. For example you could have errors in your script and FireFox might be more permissive to errors than IE. Also you might have used some specific features not implemented by IE and which work fine in FireFox.
This doens't work, because embed tag doesn't work in IE. This browser use different tag.
Read this article in order to know, how make flash movie working in different browsers. Even though, ancient IE3 and Netscape navigator browsers are described there, article is still correct for modern browsers and usefull.
精彩评论