欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

CSS、HTML和JavaScript更改后,使用Google Places API的網站無法運行

錢琪琛2年前9瀏覽0評論

在這里自學初學程序員,嘗試用CSS,HTML,和JavaScript建立一個網站。我一直在迭代,突然做了一個改變,讓網站停止運行。

我的代碼如下。我不知道是什么問題。錯誤為:crbug/1173575,非JS模塊文件已棄用。

作為背景,我正在制作一個展示北京夜生活的網站,與Google Places API相連。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Panda Party - Discover Beijing's Nightlife</title>
  <link rel="stylesheet" href="app.css"> <!-- Link to your CSS file -->
</head>
<body>
  <!-- Header -->
  <header>
    <nav>
      <div class="container">
        <h1>Panda Party</h1>
        <ul>
          <li><a href="#">Home</a></li>
          <li><a href="#">Explore</a></li>
          <li><a href="#">Favorites</a></li>
          <li><a href="#">About</a></li>
        </ul>
      </div>
    </nav>
  </header>

  <!-- Main Content -->
<main>
    <!-- Explore Section -->
    <section class="explore">
      <div class="container">
        <h3>Explore Beijing's Nightlife</h3>
        <p>Find bars, clubs, and restaurants open late serving alcohol and bar-type food</p>
      </div>
    </section>
  
    <!-- Establishment Listings -->
    <section class="listings">
      <div class="container">
        <h4>Bars</h4>
        <div id="barsContainer"></div>
      </div>
    </section>
  
    <section class="listings">
      <div class="container">
        <h4>Nightclubs</h4>
        <div id="nightClubsContainer"></div>
      </div>
    </section>
  
    <section class="listings">
      <div class="container">
        <h4>Restaurants</h4>
        <div id="restaurantsContainer"></div>
      </div>
    </section>
  </main>
  
  
  <!-- Footer -->
  <footer>
    <div class="container">
      <p>&copy; 2023 Panda Party. All rights reserved.</p>
    </div>
  </footer>
  <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAZHlXDPFdu9JQBVNQC1bgCeu3sgvhto08&libraries=places&callback=initMap"></script>
  <script src="app.js"></script> <!-- Link to your JavaScript file -->

</body>
</html>


/* Reset default browser styles */
html, body {
    margin: 0;
    padding: 0;
  }
  
  /* Header styles */
  header {
    background-color: #000;
    color: #fff;
    padding: 20px;
  }
  
  nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  
  nav ul li {
    display: inline-block;
    margin-left: 20px;
  }
  
  nav ul li a {
    color: #fff;
    text-decoration: none;
  }
  
  /* Main content styles */
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
  }
  
  .hero {
    background-image: url("background-image.jpg");
    background-size: cover;
    background-position: center;
    text-align: center;
    padding: 50px;
    color: #fff;
  }
  
  .hero h2 {
    font-size: 40px;
    margin-bottom: 20px;
  }
  
  .hero p {
    font-size: 24px;
    margin-bottom: 40px;
  }
  
  .btn {
    display: inline-block;
    padding: 15px 30px;
    background-color: #e74c3c;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
  }
  
  .btn:hover {
    background-color: #c0392b;
  }
  
  /* Explore section styles */
  .explore {
    background-color: #fff;
    padding: 40px;
    text-align: center;
  }
  
  .explore h3 {
    font-size: 32px;
    margin-bottom: 20px;
  }
  
  .explore p {
    font-size: 18px;
    color: #888;
  }
  
  /* Footer styles */
  footer {
    background-color: #000;
    color: #fff;
    padding: 20px;
    text-align: center;
  }
  /* CSS code to style the establishment listings */

.listings {
    margin-top: 20px;
  }
  
  .listings .container {
    display: flex;
    flex-wrap: wrap;
  }
  
  .listing-item {
    width: 50%; /* Adjust the width based on your layout */
    padding: 10px;
    box-sizing: border-box;
  }
  
  .listing-item h4 {
    margin-top: 0;
    margin-bottom: 5px;
  }
  
  .listing-item p {
    margin-top: 0;
    margin-bottom: 10px;
  }
  
  .listing-item span {
    font-weight: bold;
  }
  
  .listing-box {
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 20px;
    background-color: #f9f9f9;
  }
  
  .listing-box .rating {
    margin-bottom: 10px;
  }
  
  .listing-box .rating img {
    width: 16px;
    height: 16px;
  }
  
  .listing-box .offerings {
    margin-bottom: 10px;
  }
  
  .listing-box .tagline {
    font-style: italic;
  }
  
  /* Optional: Add additional styling as per your design requirements */
  


// Function to fetch and process data from Google Places API
function getPlacesData() {
    // Set up the request parameters
    var request = {
      location: new google.maps.LatLng(39.9042, 116.4074), // Specify the latitude and longitude of Beijing
      radius: 2303, // Set the search radius in meters
      types: ['bar', 'night_club', 'restaurant'], // Include multiple types of establishments
      key: 'AIzaSyAZHlXDPFdu9JQBVNQC1bgCeu3sgvhto08' // Replace with your actual API key
    };
  
    // Send the request to the PlacesService API
    var service = new google.maps.places.PlacesService(document.createElement('div'));
    service.nearbySearch(request, processResults);
  }
  
  // Function to process the results from the API request
  function processResults(results, status) {
    if (status === google.maps.places.PlacesServiceStatus.OK) {
      // Get the container elements for each establishment type
      var barsContainer = document.getElementById('barsContainer');
      var nightClubsContainer = document.getElementById('nightClubsContainer');
      var restaurantsContainer = document.getElementById('restaurantsContainer');
  
      // Iterate over the results and create HTML elements for each establishment
      for (var i = 0; i < results.length; i++) {
        var place = results[i];
        var name = place.name;
        var address = place.vicinity;
        var rating = place.rating || 'N/A';
        var type = place.types[0] || 'N/A'; // Get the primary type of the establishment
  
        // Create HTML elements for the establishment listing
        var listingItem = document.createElement('div');
        listingItem.classList.add('listing-item');
  
        var listingBox = document.createElement('div');
        listingBox.classList.add('listing-box');
  
        var establishmentElement = document.createElement('div');
        establishmentElement.classList.add('establishment');
  
        var nameElement = document.createElement('h4');
        nameElement.textContent = name;
        establishmentElement.appendChild(nameElement);
  
        var addressElement = document.createElement('p');
        addressElement.textContent = 'Address: ' + address;
        establishmentElement.appendChild(addressElement);
  
        var ratingElement = document.createElement('div');
        ratingElement.classList.add('rating');
        ratingElement.textContent = 'Rating: ' + rating;
        establishmentElement.appendChild(ratingElement);
  
        var typeElement = document.createElement('p');
        typeElement.textContent = 'Type: ' + type;
        establishmentElement.appendChild(typeElement);
  
        // Append the establishment element to the corresponding container based on the type
        if (type === 'bar') {
          barsContainer.appendChild(listingItem);
        } else if (type === 'night_club') {
          nightClubsContainer.appendChild(listingItem);
        } else if (type === 'restaurant') {
          restaurantsContainer.appendChild(listingItem);
        }
      }
    }
  }

試過ChatGPT,它說一切應該沒問題。真的不知道是什么問題。