JS循環

1.JS for循環javascript

<html>
<head>
<script type="text/javascript">
function product(a,b)
{
return a*b
}
</script>
</head>html

<body>
<script type="text/javascript">
document.write(product(6,5))
</script>java

<p>body 部分中的腳本調用一個帶有兩個參數(6 和 5)的函數。</p>
<p>該函數會返回這兩個參數的乘積。</p>ide

</body>
</html>
 函數

2.循環產生html標籤htm

<html>
<body>ip

<script type="text/javascript">
for (i = 1; i <= 6; i++)
{
document.write("<h" + i + ">這是標題 " + i)
document.write("</h" + i + ">")
}
</script>it

</body>
</html>
 io

相關文章
相關標籤/搜索