亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用復選框過濾 Google 地圖標記

使用復選框過濾 Google 地圖標記

收到一只叮咚 2021-06-09 06:09:12
當用戶選擇一個復選框并單擊“在地圖上顯示”時,我試圖顯示某些標記。選擇“高迪之旅”時應顯示 2 個標記,選擇“哥特式之旅”時應顯示兩個不同的標記。但是,它不會過濾 createMarkers() 函數中的結果,而是在單擊按鈕時顯示所有標記。我不明白為什么它沒有過濾結果,我沒有收到任何錯誤。<section>        <div class="container">            <h2>Choose your tour:</h2>            <div class="container" id="selectTour">                <div class="form-check-inline">                    <label class="form-check-label">                        <input type="checkbox" class="form-check-input" id="one">Gaudi Tour                    </label>                </div>                <div class="form-check-inline">                    <label class="form-check-label">                        <input type="checkbox" class="form-check-input" id="two">Gothic Tour                    </label>                </div>            </div>            <div class="container">                <button onclick="updateMarkers();">Show on Map</button>            </div>            <!--The Map-->            <div class="container">                <div id="map"></div>            </div>        </div>    </section>var map;var markers = [];//---------------------Data of Locations-----------------let locations = [{        name: 'one',        tour: 'gaudi',        coords: { lat: 41.403706, lng: 2.173504 },        content: 'google',    },    {        name: 'one',        tour: 'gaudi',        coords: { lat: 41.4145, lng: 2.1527 },        content: 'maps',    },    {        name: 'two',        tour: 'gothic',        coords: { lat: 41.3839, lng: 2.1821 },        content: 'are'    },    {        name: 'two',        tour: 'gothic',        coords: { lat: 41.3840, lng: 2.1762 },        content: 'annoying'    }];//---------------------Initializing Map-----------------function initMap() {    var mapOptions = {        center: new google.maps.LatLng(41.3851, 2.1734),        zoom: 12    };    map = new google.maps.Map(document.getElementById("map"), mapOptions);}任何建議都會有很大幫助。
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 166 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號