Reputation: 197
I am using a function in conjunction with FusionCharts. I am using a function that gets rid of the charts if no data can be found for it. The function is from FusionCharts.
It runs fine with Firefox and Chrome but screws the whole Drupal page in IE. Can you look at the code and see if I improperly wrote it. Thanks.
<script type='text/javascript'><!--
FusionCharts('Yield_Tab_3a_Growth_of_100000').addEventListener (
['NoDataToDisplay', 'DataXMLInvalid'],
function() {
FusionCharts('Yield_Tab_3a_Growth_of_100000').dispose();
}
);
</script>
Upvotes: 0
Views: 150
Reputation: 72857
You seem to be missing a //-->
before your </script>
tag:
<script type='text/javascript'><!--
FusionCharts('Yield_Tab_3a_Growth_of_100000').addEventListener (
['NoDataToDisplay', 'DataXMLInvalid'],
function() {
FusionCharts('Yield_Tab_3a_Growth_of_100000').dispose();
}
);
//-->
</script>
Without that, you have a unclosed HTML comment. That could mess up your page big time.
-->
: End of the HTML comment
//
: Comment out the -->
in your JavaScript, to prevent syntax errors.
However, nowadays you can just remove the comment altogether:
<script type='text/javascript'>
FusionCharts('Yield_Tab_3a_Growth_of_100000').addEventListener (
['NoDataToDisplay', 'DataXMLInvalid'],
function() {
FusionCharts('Yield_Tab_3a_Growth_of_100000').dispose();
}
);
</script>
Upvotes: 0
Reputation: 101690
As others have mentioned, the primary issue is that you're missing the end to your comment, but the more modern way to prevent JavaScript from interfering with your HTML markup is to use a CDATA block:
<script type='text/javascript'>
//<![CDATA[
FusionCharts('Yield_Tab_3a_Growth_of_100000').addEventListener (
['NoDataToDisplay', 'DataXMLInvalid'],
function() {
FusionCharts('Yield_Tab_3a_Growth_of_100000').dispose();
}
);
//]]>
</script>
Though that's not really necessary in this case either because you're not using any < or & symbols in your code.
Upvotes: 1
Reputation: 1749
Remove the <!--
. You should not be using these comment tags anymore. https://stackoverflow.com/a/808850/897559
Upvotes: 1
Reputation: 6752
I see a missing comment tag that you started at the beginning. IE might be a little more sensitive to that
<script type='text/javascript'><!--
FusionCharts('Yield_Tab_3a_Growth_of_100000').addEventListener (
['NoDataToDisplay', 'DataXMLInvalid'],
function() {
FusionCharts('Yield_Tab_3a_Growth_of_100000').dispose();
}
);
//-->
</script>
The line I added is right above
Upvotes: 0