安科网
源代码:
点击运行
<!DOCTYPE html> <html> <body> <p>Click the button to loop from 1 to 6, to make HTML headings.</p> <button onclick="myFunction()">Try it</button> <div id="demo"></div> <script> function myFunction() { var x="",i; for (i=1; i<=6; i++) { x=x + "<h" + i + ">Heading " + i + "</h" + i + ">"; } document.getElementById("demo").innerHTML=x; } </script> </body> </html>
运行结果
Copyright © 2013 - 2019 Ancii.com All Rights Reserved
京ICP备18063983号-5
京公网安备11010802014868号