1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>for 문</title></head>
<body>
<h3>for 문으로 10px~35px 크기 출력</h3>
<hr>
<script>
// document.write("<span style='font-size:10px'>10px</span>");를 출력하면 10px 크기로 글자가 출력된다
for(var size=10; size<=35; size+=5) { // 5씩 증가
    document.write("<span ");
    document.write("style='font-size:" + size + "px'>");
    document.write(size + "px"); // size는 출력되는 글자
    document.write("</span>");
}
</script>
</body>
</html>
 
cs

Posted by 너래쟁이
: