hi i got this error in java script i am trying to run from server side in this script i use for loop in which i get value for loop runs more then 3000 times and get value from array having mare then 3000 values my script is,
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Year');
data.addColumn('number', 'Sales');
开发者_JAVA技巧 data.addRows(count);
for (var i=0;i<count;i++)
{
data.setValue(i, 0, '"+Dvar[i]+"');
data.setValue(i, 1, "+Pvar[i]+");
}
var chart = new
google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, {width: 400, height: 240, title: 'Company Performance'});
}
</script>
i am using this script server side so this script is in the string and count is mentioned oudside this script as array (Dvar) and (Pvar) and count value would be more then 3000 or is there any error in this script regarding loop hopes for your suggestions..
You said count is defined as an array, then you problem is this line:
for (var i=0;i<count;i++)
you cant use count directly for count's length, it should have been
for (var i=0;i<count.length ;i++)
精彩评论