首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JSFiddle到HTML文件

JSFiddle到HTML文件
EN

Stack Overflow用户
提问于 2016-05-11 01:35:20
回答 1查看 86关注 0票数 0

我用JSFiddle构建了一个交互式谷歌地图的工作模板,但当我试图将它拼凑成一个工作文件放在我的网站上时,它并没有加载地图部分。

我觉得问这个问题很愚蠢,但我是一个非常业余的人--我需要做什么命令/头部等才能把这个网站重新组合在一起,让它在jsfiddle之外运行?

下面是jsfiddle:

http://jsfiddle.net/kamelkid2/drytwvL8/114/

这就是我试图拼凑起来的逻辑流程

代码语言:javascript
复制
<!DOCTYPE html>
<html>

<style type="text/css">
#map-canvas {
    width: 700px;
    height: 500px;
}
</style>    

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">

[javascript stuff] 
[html div portion]

这是我的整个文件

代码语言:javascript
复制
<!DOCTYPE html>
<html>
<style type="text/css">
#map-canvas {
    width: 700px;
    height: 500px;
}
</style>

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">

var gmarkers1 = [];
var markers1 = [];
var infowindow = new google.maps.InfoWindow({
    content: ''
});

// Our markers
markers1 = [
    ['0', 'Cascade Park - 130 Lynn Dr, Hudson, OH 44236', 41.234830, -81.453479], //updated with guesses
    ['1', 'Solon Community Park - 33955 Sherbrook Park Dr, Solon, OH 44139', 41.402313, -81.437936], //updated with guesses
    ['2', 'Middleton Park - 1708 Middleton Rd, Hudson, OH 44236', 41.268963, -81.450649], //updated with guesses
    ['3', 'Silver Springs Park - 5027 Stow Rd Stow, OH 44224', 41.196766, -81.417072], //updated with guesses
    ['4', 'Liberty Park - 9385 Liberty Rd Twinsburg, OH 44087', 41.317218, -81.419225], //updated with guesses
    ['5', 'Sunny Lake Park - 885 E Mennonite Rd Aurora, OH 44202', 41.290323, -81.318730], //updated with guesses
    ['6', 'Aurora Premium Outlets - 549 S Chillicothe Rd, Aurora, OH 44202', 41.301904, -81.341941] //updated with guesses
];

var items = [
[1,1,1,1,0,1,0,1,1,0,0,1,1,0,0,0,1],
[1,1,1,1,1,1,1,0,1,0,1,1,1,0,0,1,0],
[1,1,1,1,1,1,0,1,1,1,0,1,0,0,0,0,1],
[1,1,1,1,1,0,1,0,1,0,1,1,0,0,0,1,1],
[1,1,1,1,0,1,0,1,1,0,0,1,1,0,0,0,1],
[1,1,1,1,0,1,0,1,1,1,0,1,0,0,1,1,1],
[1,1,1,1,0,1,0,1,0,0,0,1,1,1,1,1,0]
];

//[0] show marker
//[1] has playground
//[2] has baby swing 
//[3] has belt swing
//[4] has handicap swing
//[5] toddler friendly
//[6] RF ground
//[7] WC ground
//[8] Pavillion
//[9] Grill
//[10] ramps
//[11] restrooms
//[12] close restrooms
//[13] nursing station
//[14] changing table
//[15] stroller friendly
//[16] walking trails

/**
 * Function to init map
 */

function initialize() {
    var center = new google.maps.LatLng(41.334830, -81.453479);
    var mapOptions = {
        zoom: 10,
        center: center,
        mapTypeId: google.maps.MapTypeId.TERRAIN
    };

    map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
    for (i = 0; i < markers1.length; i++) {
        addMarker(markers1[i]);
    }
}

/**
 * Function to add marker to map
 */

function addMarker(marker) {
    var title = marker[1];
    var pos = new google.maps.LatLng(marker[2], marker[3]);
    var content = marker[1];

    marker1 = new google.maps.Marker({
        title: title,
        position: pos,
        map: map
    });

    gmarkers1.push(marker1);

    // Marker click listener
    google.maps.event.addListener(marker1, 'click', (function (marker1, content) {
        return function () {
            console.log('Gmarker 1 gets pushed');
            infowindow.setContent(content);
            infowindow.open(map, marker1);
            map.panTo(this.getPosition());
        }
    })(marker1, content));
}

/**
 * Function to filter markers by category
 */


filterMarkersPG = function (categorypg) {

        //set all to view
        for (i = 0; i < markers1.length; i++) {
        items[i][0] = 1;
        marker = gmarkers1[i];
        marker.setVisible(true);
        //window.alert("setting all to yes");
    }

        //import checkbox values
        var PlaygroundCheck = document.getElementById("playground").checked;
    var BabySwingCheck = document.getElementById("babyswing").checked;
    var BeltSwingCheck = document.getElementById("beltswing").checked;
    var HandicapSwingCheck = document.getElementById("handicapswing").checked;
    var ToddlerFriendlyCheck = document.getElementById("toddlerfriendly").checked;
    var RFGroundCheck = document.getElementById("rfground").checked;
    var WCGroundCheck = document.getElementById("wcground").checked;
    var PavillionCheck = document.getElementById("pavillion").checked;
    var GrillCheck = document.getElementById("grill").checked;
    var RampsCheck = document.getElementById("ramps").checked;
    var RestroomsCheck = document.getElementById("restrooms").checked;
    var CloseRestroomsCheck = document.getElementById("closerestrooms").checked;
    var NursingStationCheck = document.getElementById("nursingstation").checked;
    var ChangingTableCheck = document.getElementById("changingtable").checked;
    var StrollerFriendlyCheck = document.getElementById("strollerfriendly").checked;
    var WalkingTrailsCheck = document.getElementById("walkingtrails").checked;

    //test that it still works
    //window.alert(PlaygroundCheck);
    //window.alert(BabySwingCheck);

    //test if playground checkbox is checked
    if (PlaygroundCheck == true) {    

            //for all sites, loop through playground marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get playground binary
            HasPlayground = items[i][1];
            marker = gmarkers1[i];

                        //test if it has a playground
            if (HasPlayground == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of playground check


    //test if babyswing checkbox is checked
    if (BabySwingCheck == true) {    

            //for all sites, loop through babyswing marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get babyswing binary
            HasBabySwing = items[i][2];
            marker = gmarkers1[i];

                        //test if it has a babyswing
            if (HasBabySwing == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of baby swing test


    //test if beltswing checkbox is checked
    if (BeltSwingCheck == true) {    

            //for all sites, loop through babyswing marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get beltswing binary
            HasBeltSwing = items[i][3];
            marker = gmarkers1[i];

                        //test if it has a beltswing
            if (HasBeltSwing == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of belt swing test

    //test if handicapswing checkbox is checked
    if (HandicapSwingCheck == true) {    

            //for all sites, loop through babyswing marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get handicapswing binary
            HasHandicapSwing = items[i][4];
            marker = gmarkers1[i];

                        //test if it has a handicapswing
            if (HasHandicapSwing == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of handicap swing test

    //test if toddlerfriendly checkbox is checked
    if (ToddlerFriendlyCheck == true) {    

            //for all sites, loop through babyswing marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get handicapswing binary
            HasToddlerFriendly = items[i][5];
            marker = gmarkers1[i];

                        //test if it has a handicapswing
            if (HasToddlerFriendly == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of ToddlerFriendly swing test

    //test if rf ground checkbox is checked
    if (RFGroundCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasRFGround = items[i][6];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasRFGround == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of RFGround test

    //test if wc ground checkbox is checked
    if (WCGroundCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasWCGround = items[i][7];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasWCGround == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of WCGround test

    //test if pavillion checkbox is checked
    if (PavillionCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasPavillion = items[i][8];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasPavillion == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of pavillion test

     //test if grill checkbox is checked
    if (GrillCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasGrill = items[i][9];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasGrill == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of grill test

     //test if ramp checkbox is checked
    if (RampsCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasRamps = items[i][10];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasRamps == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of ramps test

     //test if restrooms checkbox is checked
    if (RestroomsCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasRestrooms = items[i][11];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasRestrooms == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of restrooms test

     //test if close restrooms checkbox is checked
    if (CloseRestroomsCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasCloseRestrooms = items[i][12];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasCloseRestrooms == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of close restrooms test

    //test if nursingstation checkbox is checked
    if (NursingStationCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasRamps = items[i][13];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasRamps == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of ramps test

    //test if changing table checkbox is checked
    if (ChangingTableCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasChangingTable = items[i][14];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasChangingTable == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of changing table test

    //test if stroller friendly checkbox is checked
    if (StrollerFriendlyCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasStrollerFriendly = items[i][15];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasStrollerFriendly == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of changing table test

    //test if walking trails checkbox is checked
    if (WalkingTrailsCheck == true) {    

            //for all sites, loop through marker
            for (i = 0; i < markers1.length; i++) {  

            //if it is still enabled (we dont want to reenable a previously disabled)
            if (items[i][0] == 1){

            //get binary
            HasWalkingTrails = items[i][16];
            marker = gmarkers1[i];

                        //test if it has it
            if (HasWalkingTrails == 1){
                    //set the marker to true (probably redundant)
                marker.setVisible(true);
            }
            else {
                    //set the marker to false
                marker.setVisible(false);

                //prevent it from being viewed again in the loop
                items[i][0] = 0;

            }

            }

        }

    } //end of walking Trails test


}


// Init map
initialize();
</script>

<div id="map-canvas"></div>
<br>
<table>

<tr><u>Required Items (Select All That Apply):</u></tr><br>

<tr>
<td><input type='checkbox' id='playground' onclick="filterMarkersPG(this.value);">Has Playground</td>
<td><input type='checkbox' id='toddlerfriendly' onclick="filterMarkersPG(this.value);">Toddler Friendly</td>
<td><input type='checkbox' id='grill' onclick="filterMarkersPG(this.value);">Has Grill</td>
<td><input type='checkbox' id='nursingstation' onclick="filterMarkersPG(this.value);">Has Nursing Station</td>
</tr>

<tr>
<td><input type='checkbox' id='babyswing' onclick="filterMarkersPG(this.value);">Has Baby Swings</td>
<td><input type='checkbox' id='rfground' onclick="filterMarkersPG(this.value);">Rubber Flooring</td>
<td><input type='checkbox' id='ramps' onclick="filterMarkersPG(this.value);">Has Ramps</td>
<td><input type='checkbox' id='changingtable' onclick="filterMarkersPG(this.value);">Has Changing Table</td>
</tr>

<tr>
<td><input type='checkbox' id='beltswing' onclick="filterMarkersPG(this.value);">Has Belt Swings</td>
<td><input type='checkbox' id='wcground' onclick="filterMarkersPG(this.value);">Wood Chips Flooring</td>
<td><input type='checkbox' id='restrooms' onclick="filterMarkersPG(this.value);">Has Restrooms</td>
<td><input type='checkbox' id='strollerfriendly' onclick="filterMarkersPG(this.value);">Stroller Friendly</td>
</tr>

<tr>
<td><input type='checkbox' id='handicapswing' onclick="filterMarkersPG(this.value);">Has Handicap Swings</td>
<td><input type='checkbox' id='pavillion' onclick="filterMarkersPG(this.value);">Has Pavillion</td>
<td><input type='checkbox' id='closerestrooms' onclick="filterMarkersPG(this.value);">Has Close Restrooms</td>
<td><input type='checkbox' id='walkingtrails' onclick="filterMarkersPG(this.value);">Has Walking Trails</td>
</tr>

</table>

</html>
EN

回答 1

Stack Overflow用户

发布于 2016-05-11 04:19:59

我在jsfiddle之外重新编写了它,并使其正常工作。我处理事情的方式略有不同。我怀疑我在某个地方出现了语法错误,或者加载了乱序的东西。

代码语言:javascript
复制
<!DOCTYPE html>
    <html> 
    <head> 
      <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 
      <title>Google Maps Multiple Markers</title> 
      <script src="http://maps.google.com/maps/api/js?sensor=false" 
              type="text/javascript"></script>
    </head> 
    <body>
      <div id="map" style="width: 700px; height: 500px;"></div>

      <script type="text/javascript">

        var markers1 = [
          ['Cascade Park - 130 Lynn Dr, Hudson, OH 44236', 41.234830, -81.453479, 1],
          ['Solon Community Park - 33955 Sherbrook Park Dr, Solon, OH 44139', 41.402313, -81.437936, 2],
          ['Middleton Park - 1708 Middleton Rd, Hudson, OH 44236', 41.268963, -81.450649, 3],
          ['Silver Springs Park - 5027 Stow Rd Stow, OH 44224', 41.196766, -81.417072, 4],
          ['Liberty Park - 9385 Liberty Rd Twinsburg, OH 44087', 41.317218, -81.419225, 5],
          ['Sunny Lake Park - 885 E Mennonite Rd Aurora, OH 44202', 41.290323, -81.318730, 6], 
          ['Aurora Premium Outlets - 549 S Chillicothe Rd, Aurora, OH 44202', 41.301904, -81.341941, 7] 
        ];

        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 10,
          center: new google.maps.LatLng(41.334830, -81.453479),
          mapTypeId: google.maps.MapTypeId.TERRAIN
        });

        var infowindow = new google.maps.InfoWindow();

        var marker, i;
        var gmarkers1 = [];

        for (i = 0; i < markers1.length; i++) {  
          marker = new google.maps.Marker({
            position: new google.maps.LatLng(markers1[i][1], markers1[i][2]),
            map: map
          });

        gmarkers1.push(marker);  

          google.maps.event.addListener(marker, 'click', (function(marker, i) {
            return function() {
              infowindow.setContent(markers1[i][0]);
              infowindow.open(map, marker);
            }
          })(marker, i));
        }


        var items = [
        [1,1,1,1,0,1,0,1,1,0,0,1,1,0,0,0,1],
        [1,1,1,1,1,1,1,0,1,0,1,1,1,0,0,1,0],
        [1,1,1,1,1,1,0,1,1,1,0,1,0,0,0,0,1],
        [1,1,1,1,1,0,1,0,1,0,1,1,0,0,0,1,1],
        [1,1,1,1,0,1,0,1,1,0,0,1,1,0,0,0,1],
        [1,1,1,1,0,1,0,1,1,1,0,1,0,0,1,1,1],
        [1,1,1,1,0,1,0,1,0,0,0,1,1,1,1,1,0]
        ];

        //[0] show marker
        //[1] has playground
        //[2] has baby swing 
        //[3] has belt swing
        //[4] has handicap swing
        //[5] toddler friendly
        //[6] RF ground
        //[7] WC ground
        //[8] Pavillion
        //[9] Grill
        //[10] ramps
        //[11] restrooms
        //[12] close restrooms
        //[13] nursing station
        //[14] changing table
        //[15] stroller friendly
        //[16] walking trails

        function ToggleMarker(a){

            //set all to view
            for (i = 0; i < markers1.length; i++) {
                items[i][0] = 1;
                marker = gmarkers1[i];
                marker.setVisible(true);
            }

            //import checkbox values
            var PlaygroundCheck = document.getElementById("playground").checked;
            var BabySwingCheck = document.getElementById("babyswing").checked;
            var BeltSwingCheck = document.getElementById("beltswing").checked;
            var HandicapSwingCheck = document.getElementById("handicapswing").checked;
            var ToddlerFriendlyCheck = document.getElementById("toddlerfriendly").checked;
            var RFGroundCheck = document.getElementById("rfground").checked;
            var WCGroundCheck = document.getElementById("wcground").checked;
            var PavillionCheck = document.getElementById("pavillion").checked;
            var GrillCheck = document.getElementById("grill").checked;
            var RampsCheck = document.getElementById("ramps").checked;
            var RestroomsCheck = document.getElementById("restrooms").checked;
            var CloseRestroomsCheck = document.getElementById("closerestrooms").checked;
            var NursingStationCheck = document.getElementById("nursingstation").checked;
            var ChangingTableCheck = document.getElementById("changingtable").checked;
            var StrollerFriendlyCheck = document.getElementById("strollerfriendly").checked;
            var WalkingTrailsCheck = document.getElementById("walkingtrails").checked;

            //test that it still works
            //window.alert(PlaygroundCheck);
            //window.alert(BabySwingCheck);

            //test if playground checkbox is checked
            if (PlaygroundCheck == true) {    

                //for all sites, loop through playground marker
                for (i = 0; i < markers1.length; i++) {  

                    //if it is still enabled (we dont want to reenable a previously disabled)
                    if (items[i][0] == 1){

                        //get playground binary
                        HasPlayground = items[i][1];
                        marker = gmarkers1[i];
                        //test if it has a playground

                        if (HasPlayground == 1){
                            //set the marker to true (probably redundant)
                            marker.setVisible(true);
                        }
                        else {
                            //set the marker to false
                            marker.setVisible(false);

                            //prevent it from being viewed again in the loop
                            items[i][0] = 0;

                        }

                    }

                }

            } //end of playground check

            //test if babyswing checkbox is checked
            if (BabySwingCheck == true) {    

                //for all sites, loop through babyswing marker
                for (i = 0; i < markers1.length; i++) {  

                    //if it is still enabled (we dont want to reenable a previously disabled)
                    if (items[i][0] == 1){

                        //get babyswing binary
                        HasBabySwing = items[i][2];
                        marker = gmarkers1[i];

                        //test if it has a babyswing
                        if (HasBabySwing == 1){
                            //set the marker to true (probably redundant)
                            marker.setVisible(true);
                        }
                        else {
                                //set the marker to false
                            marker.setVisible(false);

                            //prevent it from being viewed again in the loop
                            items[i][0] = 0;

                        }

                    }

                }

            } //end of baby swing test


        //test if beltswing checkbox is checked
        if (BeltSwingCheck == true) {    

                //for all sites, loop through babyswing marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get beltswing binary
                HasBeltSwing = items[i][3];
                marker = gmarkers1[i];

                            //test if it has a beltswing
                if (HasBeltSwing == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of belt swing test

        //test if handicapswing checkbox is checked
        if (HandicapSwingCheck == true) {    

                //for all sites, loop through babyswing marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get handicapswing binary
                HasHandicapSwing = items[i][4];
                marker = gmarkers1[i];

                            //test if it has a handicapswing
                if (HasHandicapSwing == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of handicap swing test

        //test if toddlerfriendly checkbox is checked
        if (ToddlerFriendlyCheck == true) {    

                //for all sites, loop through babyswing marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get handicapswing binary
                HasToddlerFriendly = items[i][5];
                marker = gmarkers1[i];

                            //test if it has a handicapswing
                if (HasToddlerFriendly == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of ToddlerFriendly swing test

        //test if rf ground checkbox is checked
        if (RFGroundCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasRFGround = items[i][6];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasRFGround == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of RFGround test

        //test if wc ground checkbox is checked
        if (WCGroundCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasWCGround = items[i][7];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasWCGround == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of WCGround test

        //test if pavillion checkbox is checked
        if (PavillionCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasPavillion = items[i][8];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasPavillion == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of pavillion test

         //test if grill checkbox is checked
        if (GrillCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasGrill = items[i][9];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasGrill == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of grill test

         //test if ramp checkbox is checked
        if (RampsCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasRamps = items[i][10];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasRamps == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of ramps test

         //test if restrooms checkbox is checked
        if (RestroomsCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasRestrooms = items[i][11];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasRestrooms == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of restrooms test

         //test if close restrooms checkbox is checked
        if (CloseRestroomsCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasCloseRestrooms = items[i][12];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasCloseRestrooms == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of close restrooms test

        //test if nursingstation checkbox is checked
        if (NursingStationCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasRamps = items[i][13];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasRamps == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of ramps test

        //test if changing table checkbox is checked
        if (ChangingTableCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasChangingTable = items[i][14];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasChangingTable == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of changing table test

        //test if stroller friendly checkbox is checked
        if (StrollerFriendlyCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasStrollerFriendly = items[i][15];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasStrollerFriendly == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of changing table test

        //test if walking trails checkbox is checked
        if (WalkingTrailsCheck == true) {    

                //for all sites, loop through marker
                for (i = 0; i < markers1.length; i++) {  

                //if it is still enabled (we dont want to reenable a previously disabled)
                if (items[i][0] == 1){

                //get binary
                HasWalkingTrails = items[i][16];
                marker = gmarkers1[i];

                            //test if it has it
                if (HasWalkingTrails == 1){
                        //set the marker to true (probably redundant)
                    marker.setVisible(true);
                }
                else {
                        //set the marker to false
                    marker.setVisible(false);

                    //prevent it from being viewed again in the loop
                    items[i][0] = 0;

                }

                }

            }

        } //end of walking Trails test

        }




      </script>
      <br>
    <table>

    <tr><u>Required Items (Select All That Apply):</u></tr><br>

    <tr>
    <td><input type='checkbox' id='playground' onclick="ToggleMarker(this.value);">Has Playground</td>
    <td><input type='checkbox' id='toddlerfriendly' onclick="ToggleMarker(this.value);">Toddler Friendly</td>
    <td><input type='checkbox' id='grill' onclick="ToggleMarker(this.value);">Has Grill</td>
    <td><input type='checkbox' id='nursingstation' onclick="ToggleMarker(this.value);">Has Nursing Station</td>
    </tr>

    <tr>
    <td><input type='checkbox' id='babyswing' onclick="ToggleMarker(this.value);">Has Baby Swings</td>
    <td><input type='checkbox' id='rfground' onclick="ToggleMarker(this.value);">Rubber Flooring</td>
    <td><input type='checkbox' id='ramps' onclick="ToggleMarker(this.value);">Has Ramps</td>
    <td><input type='checkbox' id='changingtable' onclick="ToggleMarker(this.value);">Has Changing Table</td>
    </tr>

    <tr>
    <td><input type='checkbox' id='beltswing' onclick="ToggleMarker(this.value);">Has Belt Swings</td>
    <td><input type='checkbox' id='wcground' onclick="ToggleMarker(this.value);">Wood Chips Flooring</td>
    <td><input type='checkbox' id='restrooms' onclick="ToggleMarker(this.value);">Has Restrooms</td>
    <td><input type='checkbox' id='strollerfriendly' onclick="ToggleMarker(this.value);">Stroller Friendly</td>
    </tr>

    <tr>
    <td><input type='checkbox' id='handicapswing' onclick="ToggleMarker(this.value);">Has Handicap Swings</td>
    <td><input type='checkbox' id='pavillion' onclick="ToggleMarker(this.value);">Has Pavillion</td>
    <td><input type='checkbox' id='closerestrooms' onclick="ToggleMarker(this.value);">Has Close Restrooms</td>
    <td><input type='checkbox' id='walkingtrails' onclick="ToggleMarker(this.value);">Has Walking Trails</td>
    </tr>

    </table>
    </body>
    </html>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37145341

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档