代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>循环输出helloworld</title>
    <script type="text/javascript">
        document.write('使用javascript循环打印helloworld')
        for(var i=0;i<5;i++){
            document.write('<h3>helloworld</h3>')
        }
        document.write('<h1>helloworld</h1>')
    </script>
</head>
<body>
文档主题内容
</body>
</html>

截图如下:

js循环输出helloworld

相关文章: