1. 程式人生 > >js:利用for迴圈,迴圈輸出HelloWord

js:利用for迴圈,迴圈輸出HelloWord

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>迴圈輸出HelloWord</title>
    <script type="text/javascript">
        document.write('使用javascript迴圈列印helloword')
        for(var i=0;i<5;i++){
            document.write('<h3>helloword</h3>')
        }
        document.write('<h1>helloword</h1>')
    </script>
</head>
<body>

</body>
</html>

迴圈後的結果為: