Page 339 - Web Applications (803) Class 11
P. 339

<HTML>
                    <HEAD>
                    <TITLE> Using break </TITLE>
                    </HEAD>
                    <BODY>
                    <H3> Using break Statement </H3>
                    <SCRIPT>
                    var i = 0;
                    while (i <= 5)
                    {
                    document.write(“Value of i is: “ + i +”<BR>”);
                    if(i == 3)
                    {
                    document.write(“loop break”);
                    break;
                    }
                    i++;
                    }
                    </SCRIPT>
                    </BODY>
                    </HTML>


















                 2.  To display numbers from 1 to 10 except number 6 by using the continue statement.

                    <HTML>
                    <HEAD>
                    <TITLE> Using continue Statement </TITLE>
                    </HEAD>
                    <BODY>
                    <H3> Using continue Statement</H3>
                    <SCRIPT>
                    var i;
                    for(i=1; i <= 10; i++)
                    {
                    if(i==6)
                    {
                    continue;

                                                                      Introduction to Dynamic Websites Using JavaScript  337
   334   335   336   337   338   339   340   341   342   343   344