一、JavaScript跳转语句
1.break
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> for(var i=0; i<10; i++){ if (i==5){ break; } document.write("i="+i+"<br/>"); } </script> </body> </html>
2.continue
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> for(var i=0; i<10; i++){ if (i==5){ continue; } document.write("i="+i+"<br/>"); } </script> </body> </html>
注意:上例中的continue语句打印输出的内容中没有"i=5"这一项!
原文地址:http://11317783.blog.51cto.com/11307783/1791899