//while循环 <script type="text/javascript"> i = 1; while (i <= 6) { document.write("<h" + i+">这是标题"+i); document.write("</h"+i+">"); i++; } </script>
//do_whilel循环 <script type="text/javascript"> i = 1; do { document.write("<h" + i+">这是标题"+i); document.write("</h"+i+">"); i++; } while(i<=6); </script>
//for循环 <script type="text/javascript"> for(i=1;i<=6;i++) { document.write("<h"+i+">这是标题"+i); document.write("</h"+i+">"); } </script>
结果: