JavaScript - Can anyone help out in this - Asked By Mano on 10-Sep-10 02:33 AM

<script>

var i;
i=1;

 while (i <=78) 
{

 document.write(i);
 i++;
}

</script>

this is simple statement which is printing result in a horizontal wise but can i use break statement in between this while Loop for example 
1
2
3
..

...

....

....

78
Sagar P replied to Mano on 10-Sep-10 02:36 AM
Simple instead of document.write use docuemnt.writeln like;

<script>

var i;
i=1;

 while (i <=78) 
{

 document.writeln(i);
 i++;
}

</script>
Mano replied to Sagar P on 10-Sep-10 04:06 AM
at  here it will get printed like this 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19..............................78
but i want to print as like 
1
2
3
4
5
.
.
.
.
78
can it possible

Kirtan Patel replied to Mano on 10-Sep-10 07:01 AM
 <script>
      var x = 78;
      var i=1;
      while (i<= x) 
      {
        document.write(i + "<br/>");
        i++;
      }
    </script>