I've made the function drawGraph() (see below) to draw a bell-curve in javascript. An image swap (line 29) changes a background pixel image to a colored pixel image in a graph previously generated. In Opera the bell-curve is generated "live", while in Explorer nothing is displayed until the loop graph is finished. This definitely makes the program less fun to watch in Explorer. The counter that's supposed to show how far the program has come in drawing the curve (line 32) also works nicely in Opera but not in Explorer.

So how do i get Explorer to update the drawing of the graph continuously?

I would be very grateful if somebody could help me with this!

PS. If some of the comments in the function seems like gibberish it's because they're in norwegian

1. function drawGraph(number)
2. {
3. var val=0;
4. var y_minus=y_axis-1;
5. var last_checked=new Array(x_axis);
6. var filled_array=new Array(x_axis);
7. for (var tell=0; tell<x_axis; tell++)
8. {
9. last_checked[tell]=y_minus;
10. filled_array[tell]=max_fill;
11. }
12.
13. for (var dots=0; dots<number; dots++)
14. {
15. var x_val=Math.floor(x_axis/2);
16. for (var y_val=0; y_val<y_minus/2; y_val++)
17. {
18. x_val=x_val-5+Math.floor(Math.random()*11);
19. }
20.
21. // Sjekker at x_val er innenfor ytterverdiene for x-axis
22. if (x_val>=0 || x_val<x_axis)
23. {
24. filled_array[x_val]=filled_array[x_val]+1;
25. if (filled_array[x_val]>max_fill)
26. {
27. filled_array[x_val]=0;
28. var temp=last_checked[x_val];
29. pixel_array[x_val][temp].src="colored_pixel.jpg";
30. last_checked[x_val]=last_checked[x_val]-1;
31. }
32. the_counter.value = dots+" av "+number;
33. }
34. }
35. the_counter.value = "Ferdig!";
36.
37. }