<html> <body> <script type="text/javascript"> for (i = 1; i <= 6; i++) { document.write("<h" + i + ">这是标题 " + i) document.write("</h" + i + ">") } </script> </body> </html>
这是标题 1
这是标题 2
这是标题 3
这是标题 4
这是标题 5
这是标题 6
<html> <body> <script type="text/javascript"> for (i = 1; i <= 6; i++) { document.write("<h" + i + ">这是标题 " + i) document.write("</h" + i + ">") } </script> </body> </html>
转载于:https://www.cnblogs.com/lanmo520/archive/2012/11/12/2767103.html