鄭文綝VBA迴圈Loop與JavaScript迴圈
VBA迴圈畫圖
JavaScript雙迴圈
輸出
EXCEL VBA雙迴圈
Option Explicit '必須宣告所有變數variables Dim i, j As Integer '宣告dimension i, j 是整數integer Public Sub 鄭文綝() Cells(1, 1).Value = "鄭文綝問號" Cells(1, 1).Font.Size = 20 Cells(1, 1).Interior.Color = RGB(128, 0, 0) Cells(1, 1).Font.Color = RGB(255, 255, 255) End Sub Public Sub 鄭文綝迴圈() For i = 2 To 10 For j = 1 To 6 Cells(i, j).Value = (2010 + i) & "年" & j & "月" Next Next End Sub
RGB顏色控制
檔案前頭程式碼
<style> h1{text-align: center;padding: 20px; background: #890089; color: #FFFFFF; }
</style>
<script>
function year()
{ var tmp="<font size=5>" ;//宣告一個字串變數tmp
for (var i=2010; i<2022; i++)
tmp = tmp + i +"年<br>";
tmp = tmp + "</font>"
document.getElementById("out").innerHTML = tmp;
}
</script>
<h1>JavaScript雙迴圈</h1>
<input type="button" value="劉任昌年" onclick="year()">
<p id="out">輸出</p>
留言
張貼留言