๋ฐ˜์‘ํ˜•
250x250
Recent Posts
ยซ   2024/12   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
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 26 27 28
29 30 31
๊ด€๋ฆฌ ๋ฉ”๋‰ด

Hello creators ๐Ÿ™Œ

1-12_Javascript ๋ง›๋ณด๊ธฐ ๋ณธ๋ฌธ

728x90
๋ฐ˜์‘ํ˜•

์ด๋ฒˆ ํšŒ์ฐจ ํ•™์Šต ๋ชฉํ‘œ (goal)


  • ์ดํ•ด ํ•˜๊ณ ์ž ํ•˜๋Š” ๊ฒƒ
    • 'Javascript' ์— ๋Œ€ํ•œ ์ดํ•ด

Javascript ๊ธฐ์ดˆ ์ดํ•ด ํ•˜๊ธฐ


โ… . Javascript ๋ž€?

  • ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด ์ค‘ ํ•˜๋‚˜
  • ==๋ธŒ๋ผ์šฐ์ €== ๊ฐ€ ์•Œ์•„๋“ค์„ ์ˆ˜ ์žˆ๋Š” ์–ธ์–ด
    • python์„ ์•Œ์•„๋“ค ์„ ์ˆ˜ ์žˆ๋Š” ๋ธŒ๋ผ์šฐ์ €, javascript๋ฅผ ์•Œ์•„๋“ค์„ ์ˆ˜ ์žˆ๋Š” ์–ธ์–ด ๋“ฑ์„ ๋”ฐ๋กœ ๋งŒ๋“ค๋ฉด -> ๊ต‰์žฅํžˆ ๋ถˆํŽธํ•  ๊ฒƒ -> so, ๋ธŒ๋ผ์šฐ์ € ๊ฐ€ ์•Œ์•„๋“ค์„ ์ˆ˜ ์žˆ๋Š” ์–ธ์–ด๋ฅผ javascript ๋กœ ์ •ํ•จ
    • ์ฆ‰, ๋ชจ๋“  ์ธํ„ฐ๋„ท์„ ๊ตฌํ˜„ํ•  ๋•Œ, 'javascript' ๋งŒ ์“ฐ์ž! = ์ด๊ฒŒ =='ํ‘œ์ค€'== ์ด๋ผ๋Š” ๊ฐœ๋….

  • Java ๋ž‘ Javascript ์˜ ๊ด€๋ จ์„ฑ?
    • ์—†์Œ.

โ…ก. javascript ๋ฅผ ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉ?


1. ์–ด๋””์—์„œ ์จ?

  • style ๋ฐ‘์— ์žˆ๋Š”, script ํƒœ๊ทธ ์— ์ž‘์„ฑ

2. ์ด๋ฒˆ ์˜ˆ์ œ์—์„œ ๋ญ˜ ํ•˜๊ฒŒ ํ• ๊ฑฐ์•ผ?

  • click ํ•˜๋ฉด -> hey() ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•ด์„œ -> ์•ˆ๋…•! ์„ ๋ถˆ๋ ค์ฃผ๊ฒŒ ํ• ๊ฑฐ์•ผ.
    - ๊ทธ๋Ÿฌ๋ฉด, ๋ญ๊ฐ€ ์ž‘์„ฑ๋˜์–ด์•ผ ํ•ด? - 1) ํ•จ์ˆ˜ `์ •์˜` - 2) ํ•จ์ˆ˜ `ํ˜ธ์ถœ` - ๐Ÿ™Œ ์ด๋ ‡๊ฒŒ 2๋ถ€๋ถ„์ด ์žˆ์–ด์•ผ ํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ•จ.

3. ๊ทธ๋Ÿฌ๋ฉด, ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ด๋ณด๋ฉด!

  • 23.01.23 ํ•™์Šต ๋…นํ™”![[vertical_Trim 1.mp4]]
  • ์ด๊ฒƒ ์ž‘์„ฑ ํ•  ๋•Œ ์–ด๋ ค์› ๋˜ ๋ถ€๋ถ„ ๐Ÿ“›๐Ÿ“›๐Ÿ“›
    • ํ•จ์ˆ˜ ์ •์˜ ํ•  ๋•Œ, script ์˜ ์œ„์น˜!
    • onclick ํ•  ๋•Œ, ์–ด๋–ค button ์— ํ–ˆ์–ด์•ผ ํ•˜๋Š”์ง€.

์ „์ฒด ์ฝ”๋“œ ๐Ÿ”—

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
        crossorigin="anonymous"></script>

    <title>์ŠคํŒŒ๋ฅดํƒ€์ฝ”๋”ฉํด๋Ÿฝ | ๋ถ€ํŠธ์ŠคํŠธ๋žฉ ์—ฐ์Šตํ•˜๊ธฐ</title>

    <!-- ํƒ€์ดํ‹€ ๋ฐ‘์— ๋„ฃ๊ธฐ -->
    <link href="https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap" rel="stylesheet">

    <style>
        /* <!-- style ๋ฐ‘์— ๋„ฃ๊ธฐ --> */
        * {
            font-family: 'Gowun Dodum', sans-serif;
        }

        .mytitle {
            /* div ๋ฐ•์Šค ์ž์ฒด ๋ฐฐ๊ฒฝ ์ƒ‰ */
            background-color: green;

            /* div ๋ฐ•์Šค ์ž์ฒด ํฌ๊ธฐ ์กฐ์ ˆ */
            width: 100%;
            height: 250px;

            /* ์ƒ์–ด ์ด๋ฏธ์ง€ ๋„ฃ๊ธฐ */
            background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("https://movie-phinf.pstatic.net/20210715_95/1626338192428gTnJl_JPEG/movie_image.jpg");
            background-position: center;
            background-size: cover;

            /* ๊ธ€์”จ ํฐ์ƒ‰ */
            color: white;

            /* โญโญโญ div ์•ˆ ๋‚ด์šฉ๋ฌผ์„ ๊ฐ€์šด๋ฐ๋กœ ์†์‰ฝ๊ฒŒ ์ •๋ ฌํ•˜๊ธฐ (4๊ฐ€์ง€ set) */
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        /* โญโญโญ div ์•ˆ์— ์žˆ๋Š” button ๋‚ด ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•œ syntax */
        .mytitle>button {
            /* ๋ฒ„ํŠผ ์‚ฌ์ด์ฆˆ */
            width: 200px;
            height: 50px;

            /* ํˆฌ๋ช…์ƒ‰ */
            background-color: transparent;
            color: white;

            /* ํ…Œ๋‘๋ฆฌ ๋‘ฅ๊ธ€๊ฒŒ, ์‹ค์„  */
            border-radius: 50px;
            border: 1px solid white;

            /* ์‚ด์ง ๊ณต๊ฐ„ ์ฃผ๊ธฐ */
            margin-top: 10px;

        }

        /* ๋ฒ„ํŠผ์ด ์˜ฌ๋ผ๊ฐ”์„ ๋•Œ -> ๊ตต์–ด์ง€๊ฒŒ ํ•˜๊ธฐ */
        .mytitle>button:hover {
            border: 2px solid white;
        }

        /* ์ฝ”๋ฉ˜ํŠธ ์ƒ‰์ƒ ๊พธ๋ฏธ๊ธฐ */
        .mycomment {
            color: gray;
        }

        /* warp ์˜์—ญ์„ ๊พธ๋ฉฐ์ฃผ๊ธฐ */
        .wrap {

            /* ํ™”๋ฉด ๋ณ€ํ™”์— ์•ˆ ๊นจ์ง€๋Š” ํ™”๋ฉด ๋งŒ๋“ค๊ธฐ */
            /* ์ปค์ง€๋ฉด ์ตœ๋Œ€ 1200px ๊นŒ์ง€๋งŒ ์ปค์งˆ ์ˆ˜ ์žˆ์–ด! */
            max-width: 1200px;
            /* ๊ทธ ์ด์ „์—๋Š” 95% ๋งŒ ์ปค์งˆ ์ˆ˜ ์žˆ์–ด.*/
            width: 95%;

            /* ์œ— ๋ถ€๋ถ„์„ ์กฐ๊ธˆ ๋” ๋–ผ์–ด์ฃผ๊ณ  ์‹ถ์Œ -> so, 20px, 0px ์„ ๋„ฃ์–ด์คŒ */
            margin: 20px auto 0px auto;
        }

        .mypost {

            /* ํ™”๋ฉด ๋ณ€ํ™”์— ์•ˆ ๊นจ์ง€๋Š” ํ™”๋ฉด ๋งŒ๋“ค๊ธฐ */
            /* ์ปค์ง€๋ฉด ์ตœ๋Œ€ 1200px ๊นŒ์ง€๋งŒ ์ปค์งˆ ์ˆ˜ ์žˆ์–ด! */
            max-width: 1200px;
            /* ๊ทธ ์ด์ „์—๋Š” 95% ๋งŒ ์ปค์งˆ ์ˆ˜ ์žˆ์–ด.*/
            width: 95%;


            /* div ์˜์—ญ ์žก์„ ๋•Œ, ๋ฐฑ ๊ทธ๋ผ์šด๋“œ ์˜์—ญ ์žก๊ณ  ํ•˜๋Š”๊ฒŒ ์ข‹์Œ โญโญ  */
            /* background-color: green; */
            /* width: 500px; */


            /* ์œ„์— ์‚ด์ง ๋„์šฐ๊ณ  div ์˜์—ญ ์žก๊ณ  ์‹ถ์Œ -> 10px, 0px ๋งŒ๋“ฆ */
            margin: 20px auto 0px auto;

            /* ๋ฐ•์Šค shadow ๋„ฃ๊ธฐ */
            box-shadow: 0px 0px 3px 0px gray;

            padding: 20px;

        }

        .mybtn {
            /* โญโญโญ ๊ฐ€์šด๋ฐ๋กœ ์†์‰ฝ๊ฒŒ ์ •๋ ฌํ•˜๊ธฐ (4๊ฐ€์ง€๊ฐ€ set) */
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;

            margin-top: 10px;
        }

        .mybtn>button {
            margin-right: 10px;
        }
    </style>

    <!-- โญโญโญ head style ๋ฐ‘ = javascript ์น˜๋Š” ๊ณณ -->
    <script>
        function hey() {
            alert('์•ˆ๋…•!');
        }
    </script>



</head>

<body>
    <!-- html ๋กœ ๊ธฐ๋ณธ ๋ผˆ๋Œ€ ๋งŒ๋“ค๊ธฐ -->
    <div class="mytitle">
        <h1> ๋‚ด ์ƒ์•  ์ตœ๊ณ ์˜ ์˜ํ™”๋“ค ๐ŸŽฌ </h1>
        <!-- โญโญโญ click ํ•˜๋ฉด -> hey() ํ•จ์ˆ˜ ์‹คํ–‰ํ•˜๊ฒŒ ํ•˜๊ธฐ -->
        <button onclick="hey()"> ์˜ํ™” ๊ธฐ๋กํ•˜๊ธฐ โœ๏ธ </button>
    </div>

    <div class="mypost">

        <!-- ์˜ํ™” URL  -->
        <div class="form-floating mb-3">
            <input type="email" class="form-control" id="floatingInput" placeholder="name@example.com">
            <label for="floatingInput">์˜ํ™” URL</label>
        </div>

        <p> </p>

        <div class="input-group mb-3">
            <!-- ๋ณ„์  -->
            <label class="input-group-text" for="inputGroupSelect01">๋ณ„์ </label>

            <!-- ์„ ํƒํ•˜๊ธฐ  -->
            <select class="form-select" id="inputGroupSelect01">
                <option selected> -- ์„ ํƒํ•˜๊ธฐ -- </option>
                <option value="1">โญ </option>
                <option value="2">โญโญ </option>
                <option value="3">โญโญโญ </option>
                <option value="4">โญโญโญโญ </option>
                <option value="5">โญโญโญโญโญ </option>

            </select>
        </div>

        <!-- ์ฝ”๋ฉ˜ํŠธ -->
        <div class="form-floating">
            <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea2"
                style="height: 100px"></textarea>
            <label for="floatingTextarea2">์ฝ”๋ฉ˜ํŠธ</label>
        </div>

        <!-- ๋ฒ„ํŠผ -->
        <div class="mybtn">
            <button type="button" class="btn btn-dark">๊ธฐ๋กํ•˜๊ธฐ๐Ÿ‘‡</button>
            <button type="button" class="btn btn-light">๋‹ซ๊ธฐ๐Ÿ™Œ</button>

        </div>
    </div>

    <!-- md4 ๋กœ ํ•ด์„œ > ๊ฐ€๋กœ 4์žฅ์œผ๋กœ ๋งŒ๋“ค๊ธฐ โญโญโญ  -->
    <div class="wrap">
        <div class="row row-cols-1 row-cols-md-4 g-4">
            <div class="col">
                <div class="card">
                    <!-- ํฌ์Šคํ„ฐ ์ด๋ฏธ์ง€ ๋„ฃ์–ด์ฃผ๊ธฐ โญโญโญ  -->
                    <img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
                        class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">์—ฌ๊ธฐ์— ์ œ๋ชฉ์ด ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค! </h5>
                        <p class="card-text">์—ฌ๊ธฐ์—๋Š” ๋‚ด์šฉ์ด ๋“ค์–ด๊ฐ€์ง€์š”. ํ“จ์Š. ์œจ๋•์ด๊ฐ€ ์ปจ๋””์…˜์ด ์•ˆ ์ข‹์ง€๋งŒ ํ•ด๋ƒ„๊ฑฐ์ž„ ๐Ÿ’โ€โ™€๏ธ </p>

                        <!-- ๋ณ„ํ‘œ ์˜์—ญ -->
                        <p> โญโญโญ </p>

                        <!-- ์ฝ”๋ฉ˜ํŠธ ์˜์—ญ -->
                        <p class="mycomment"> ์—ฌ๊ธฐ์— ์ฝ”๋ฉ˜ํŠธ๊ฐ€ ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค. </p>

                    </div>
                </div>
            </div>
            <div class="col">
                <div class="card">
                    <!-- ํฌ์Šคํ„ฐ ์ด๋ฏธ์ง€ ๋„ฃ์–ด์ฃผ๊ธฐ โญโญโญ  -->
                    <img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
                        class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">์—ฌ๊ธฐ์— ์ œ๋ชฉ์ด ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค! </h5>
                        <p class="card-text">์—ฌ๊ธฐ์—๋Š” ๋‚ด์šฉ์ด ๋“ค์–ด๊ฐ€์ง€์š”. ํ“จ์Š. ์œจ๋•์ด๊ฐ€ ์ปจ๋””์…˜์ด ์•ˆ ์ข‹์ง€๋งŒ ํ•ด๋ƒ„๊ฑฐ์ž„ ๐Ÿ’โ€โ™€๏ธ </p>

                        <!-- ๋ณ„ํ‘œ ์˜์—ญ -->
                        <p> โญโญโญ </p>

                        <!-- ์ฝ”๋ฉ˜ํŠธ ์˜์—ญ -->
                        <p class="mycomment"> ์—ฌ๊ธฐ์— ์ฝ”๋ฉ˜ํŠธ๊ฐ€ ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค. </p>

                    </div>
                </div>
            </div>
            <div class="col">
                <div class="card">
                    <!-- ํฌ์Šคํ„ฐ ์ด๋ฏธ์ง€ ๋„ฃ์–ด์ฃผ๊ธฐ โญโญโญ  -->
                    <img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
                        class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">์—ฌ๊ธฐ์— ์ œ๋ชฉ์ด ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค! </h5>
                        <p class="card-text">์—ฌ๊ธฐ์—๋Š” ๋‚ด์šฉ์ด ๋“ค์–ด๊ฐ€์ง€์š”. ํ“จ์Š. ์œจ๋•์ด๊ฐ€ ์ปจ๋””์…˜์ด ์•ˆ ์ข‹์ง€๋งŒ ํ•ด๋ƒ„๊ฑฐ์ž„ ๐Ÿ’โ€โ™€๏ธ </p>

                        <!-- ๋ณ„ํ‘œ ์˜์—ญ -->
                        <p> โญโญโญ </p>

                        <!-- ์ฝ”๋ฉ˜ํŠธ ์˜์—ญ -->
                        <p class="mycomment"> ์—ฌ๊ธฐ์— ์ฝ”๋ฉ˜ํŠธ๊ฐ€ ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค. </p>

                    </div>
                </div>
            </div>
            <div class="col">
                <div class="card">
                    <!-- ํฌ์Šคํ„ฐ ์ด๋ฏธ์ง€ ๋„ฃ์–ด์ฃผ๊ธฐ โญโญโญ  -->
                    <img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
                        class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">์—ฌ๊ธฐ์— ์ œ๋ชฉ์ด ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค! </h5>
                        <p class="card-text">์—ฌ๊ธฐ์—๋Š” ๋‚ด์šฉ์ด ๋“ค์–ด๊ฐ€์ง€์š”. ํ“จ์Š. ์œจ๋•์ด๊ฐ€ ์ปจ๋””์…˜์ด ์•ˆ ์ข‹์ง€๋งŒ ํ•ด๋ƒ„๊ฑฐ์ž„ ๐Ÿ’โ€โ™€๏ธ </p>

                        <!-- ๋ณ„ํ‘œ ์˜์—ญ -->
                        <p> โญโญโญ </p>

                        <!-- ์ฝ”๋ฉ˜ํŠธ ์˜์—ญ -->
                        <p class="mycomment"> ์—ฌ๊ธฐ์— ์ฝ”๋ฉ˜ํŠธ๊ฐ€ ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค. </p>

                    </div>
                </div>
            </div>
        </div>
    </div>




</body>

</html>
728x90
๋ฐ˜์‘ํ˜•
Comments