thaiduong Report post Posted May 13, 2008 (edited) I am using php with professional fusionchart. I need re-create chart when user choose value from a select box. My code work as well on IE. But I cannot re-create new chart on FireFox. Firefox always show old chart that it created on the firsttime. I try to debug javascript and saw that it always call initChart function to re-create chart. But Firefox doesn't have any changed. Please help me to solve it ASAP. I have to fix this bug for my customer. Here is my code : <html> <head> <title> new document </title> </head> <script> function onSelectChange() { var chartXML =''; //get chartXML from server and init chart //... //... initChart(chartXML); } function initChart(chartXML) { var chart = document.getElementById("chartdiv"); chart = new FusionCharts("fusion/Charts/Area2D.swf", "chartdiv", 500, 500, "0", "0"); chart.setDataXML(chartXML); chartXML = ''; chart.render("chartdiv"); } </script> <body> <form name="form1"> <select name="chart" onchange="onSelectChange()"> <option value=1>1</option> <option value=2>2</option> </select> <table width="100%"> <tr height="100%"> <td height="100%" valign="top" class="block" align="center"><div id="chartdiv" style="width:100%;height:100%;"></div></td> </tr> </table> </form> </body> Edited May 13, 2008 by Guest Share this post Link to post Share on other sites
FusionCharts Support Report post Posted May 19, 2008 Hi, Could you please provide different and unique Div ID and chart ID? Same id is causing a conflict between the 2 HTML elements ( DIV and <Embed> in FF/<object> in IE) when JavaScript is accessing the DOM. In IE luckly the first Element (the DIV) is updated. So you get to see the chart> While in FF the <embed> Element is getting accessed and the new code for chart is getting appened in the <embed> object itself withour replacing the old <embed> element. So the old chart remains in FF and the new entry is just igonred by FF as nested embed elements is not valid. So the solution is simply to provide different and unique Div ID and chart ID: e.g. var chart = new FusionCharts("Area2D.swf", "chartId", 500, 500, "0", "0"); chart.setDataXML(chartXML); chart.render("chartdiv"); Share this post Link to post Share on other sites