[关闭]
@mdjsjdq 2015-07-25T08:43:15.000000Z 字数 530 阅读 1660

javascript 第一阶段的学习总结

总结


<html>
<head><title>for_loop</title></head>
<body>
<h2>你好,HTML</h2>
<p>点击按钮,测试带有 break 语句的循环。</p>
<button onclick="myFunction()">点击这里</button>
<p id="try"></p>

<script>
function myFunction()
{
    var x = "",i = 0 ;  
    for (i=0;i<=1000;i++)   //the condition of for_loop
    {
        if (i== 0)
    {
        continue;   //escape that kinds of loop
        }   
    if (i == 500)
    {
        break;  //break the loop
        }
    x = x + "The Number is :" + i + "<br>";
        }
    document.getElementById("try").innerHTML = x;   //show the content
}
</script>

</body>
</html>

通过上面的代码,了解到怎么友好的输出javascript的内容到HTNL内容中,里面涉及到了好多个的语句以及其他的比较常用的JS编程风格。

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注