실습문제 6-6

WEB/TRAINNING 2017. 11. 14. 11:19 |

6. 브라우저 화면과 같이 출력되도록 <script> 태그 내에 함수를 작성하라.

(1)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
    <title>1</title>
</head>
<body>
<script>
    // (1) big 함수를 작성하라.
</script>
<script>
    var b = big("625","555");
    document.write("큰수=" + b);
</script>
</body>
</html>
cs




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<head>
    <title>1</title>
</head>
<body>
<script>
    function big(a,b)
    {
        if (a<b) 
        {
            return b;
        }
        else
        {
            return a;
        }
    }
</script>
<script>
    var b = big("625","555");
    document.write("큰수=" + b);
</script>
</body>
</html>
cs



(2)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
    <title>2</title>
</head>
<body>
<script>
    // (2) pr 함수를 작성하라.
</script>
<script>
    pr("%",5);
</script>
</body>
</html>
cs


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
    <title>2</title>
</head>
<body>
<script>
    function pr(m,n)
    {
        for(var i = 0 ; i <= n ; i ++ )
        document.write(m)
    }
</script>
<script>
    pr("%",5);
</script>
</body>
</html>
cs


'WEB > TRAINNING' 카테고리의 다른 글

실습문제 6-7  (0) 2017.11.18
실습문제 6-8  (0) 2017.11.18
실습문제 6-5  (0) 2017.11.14
실습문제 6-4  (0) 2017.11.14
실습문제 6-3  (0) 2017.11.13
Posted by 너래쟁이
: