javascript - Problem with loop -
possible duplicate:
javascript infamous loop problem?
when mousemove event reaised variable i
equal last value(in case = 4) sectors. can store value of i
?
for (var = 0; < piechart.sectors.length; i++) { piechart.sectors[i].mousemove(function (event) { var percent = (localdata[i] * 100) / totalsum; piechart.popup(event.clientx, event.clienty, [percent, "% всего времени\n Было сделано", localdata[i], "звонков"].join(' ')); }); }
you need closure. see here nice explanation: http://www.mennovanslooten.nl/blog/post/62
i'll posting code modified shortly.
Comments
Post a Comment