lpg.html 7.3 KB
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
        <meta name="description" content="" />
        <meta name="author" content="" />
        <title>Modern Business - Start Bootstrap Template</title>
        <!-- Favicon-->
        <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
        <!-- Bootstrap icons-->
        <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
        <!-- Core theme CSS (includes Bootstrap)-->
        <link href="css/styles.css" rel="stylesheet" />
    </head>

    <body class="d-flex flex-column">
        <main class="flex-shrink-0">
            <!-- Navigation-->
            <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
                <div class="container px-5">
                    <a class="navbar-brand" href="/">휴게소 정보</a>
                    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
                    <div class="collapse navbar-collapse" id="navbarSupportedContent">
                        <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
                            <li class="nav-item"><a class="nav-link" href="/">Home</a></li>
                            <li class="nav-item"><a class="nav-link" href="/menu">휴게소 메뉴</a></li>
                            <li class="nav-item"><a class="nav-link" href="/weather">날씨</a></li>
                            <li class="nav-item"><a class="nav-link" href="/lpg">LPG</a></li>
                            <li class="nav-item"><a class="nav-link" href="faq.html">FAQ</a></li>
                            <li class="nav-item dropdown">
                                <a class="nav-link dropdown-toggle" id="navbarDropdownBlog" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Blog</a>
                                <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownBlog">
                                    <li><a class="dropdown-item" href="blog-home.html">Blog Home</a></li>
                                    <li><a class="dropdown-item" href="blog-post.html">Blog Post</a></li>
                                </ul>
                            </li>
                            <li class="nav-item dropdown">
                                <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
                                <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
                                    <li><a class="dropdown-item" href="/login">Login</a></li>
                                    <li><a class="dropdown-item" href="/signup">Sign-up</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>
            </nav>

            <!-- Header-->
            <header class="py-5">
                <div class="container px-5">
                    <div class="row justify-content-center">
                        <div class="col-lg-8 col-xxl-6">
                            <div class="text-center my-5">
                                <h1 class="fw-bolder mb-3">LPG 충전소</h1>
                                <p class="lead fw-normal text-muted mb-4">Just search the name of the rest stop,<br>You'll find out the LPG filling station of the rest area.</p>
                               
                                <!--검색 버튼으로 검색할 휴게소 이름 입력 받기-->
                                <p><input type="text" placeholder="휴게소 이름" id="name"><input type="button"  onclick="ShowLPG()" value="확인"></p>

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

            
            <!--bar-->  
            <section class="py-3 bg-light" id="scroll-target">
                <div class="container px-1 my-1">
                    <div class="text-center">
                        <center><p><h3 class="fw-bolder"><reststop_name></reststop_name></h3></p></center>
                        <center><hr style ="height:2px; width: 55%"></hr></center>
                        <center><p><h5 class="fw-bolder"><bar1></bar1></h5></p></center>
                        <div class="container px-1 my-1"><h6 class="lead fw-normal text-muted mb-4"><bar_1></bar_1></h6><div>
                        <center><hr style ="height:2px; width: 15%"></hr></center>
                        <center><p><h5 class="fw-bolder"><bar2></bar2></h5></p></center>
                        <div class="container px-1 my-1"><h6 class="lead fw-normal text-muted mb-4"><bar_2></bar_2></h6><div>
                    </div>
                    </div>
            </section>  



            <script>

                //LPG 휴게소 open api는 LPG휴게소가 존재하는 데이터 리스트만 가지고 있음
                //따라서 fetch를 총 두 번 진행하여 첫번째에서는 LPG 휴게소 리스트를 받아와 그 중 휴게소 이름만 추출하여 리스트로 만들고
                //웹 페이지에서 검색하고자 하는 휴게소 이름을 입력받아 만약 이름이 LPG휴게소 리스트에 있다면 
                //'LPG 충전소가 있습니다'를, 없다면 'LPG 충전소가 없습니다'를 출력하도록 함

            
                //fetch로 전체 데이터 리스트를 text형태로 끌어오기
                function ShowLPG() {

                //사용자가 입력한 휴게소 이름의 값을 name 변수에 할당    
                name = document.getElementById('name').value 

                //bar부분에 휴게소 이름 출력
                document.querySelector('reststop_name').innerHTML = name;

                document.querySelector('bar1').innerHTML = 'LPG 충전소 여부';
                document.querySelector('bar2').innerHTML = '브랜드';
                }
              </script>


        <!-- Footer-->
        <footer class="bg-dark py-4 mt-auto">
            <div class="container px-5">
                <div class="row align-items-center justify-content-between flex-column flex-sm-row">
                    <div class="col-auto"><div class="small m-0 text-white">Copyright &copy; Your Website 2022</div></div>
                    <div class="col-auto">
                        <a class="link-light small" href="#!">Privacy</a>
                        <span class="text-white mx-1">&middot;</span>
                        <a class="link-light small" href="#!">Terms</a>
                        <span class="text-white mx-1">&middot;</span>
                        <a class="link-light small" href="#!">Contact</a>
                    </div>
                </div>
            </div>
        </footer>
        <!-- Bootstrap core JS-->
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
        <!-- Core theme JS-->
        <script src="js/scripts.js"></script>
    </body>
</html>