<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> 演示示例:break与continue </title> <meta http-equiv = "content-type" content ="text/html;charset=utf-8" /> <meta name="keywords" content=""> <meta name="description" content=""> </head> <body> <script type="text/javascript"> // break 中断循环 document.write("<br/>---------------break 中断循环------------<br/>"); var i=0; for (i=0;i<=10;i++) { if (i==3){break;} document.write("The number is " + i); document.write("<br />"); } </script> <script type="text/javascript"> // continue 跳过并继续接下来的循环 document.write("<br/>---------------continue 中断循环------------<br/>"); var i=0; for (i=0;i<=10;i++) { if (i==3){continue;} document.write("The number is " + i); document.write("<br />"); } </script> </body> </html>