- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 JSFiddle 中构建了一个交互式谷歌地图的工作模板,但是当我尝试将它拼凑在一起以在我的网站上拥有一个工作文件时,它没有加载 map 部分。
我觉得问这个问题很愚蠢,但我是一个非常业余的人 - 我需要做什么顺序/标题等才能将这个网站重新组合在一起并让它在 jsfiddle 之外运行?
这是 jsfiddle:
http://jsfiddle.net/kamelkid2/drytwvL8/114/
这是我试图拼凑起来的逻辑流程
<!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]
这是我的整个文件
<!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>
最佳答案
我在 jsfiddle 之外对其进行了重新设计,并让它开始工作。我处理事情的方式略有不同。我怀疑我在某处有语法错误或加载顺序不正确。
<!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>
关于javascript - JSFiddle 到 HTML 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37145341/
这个问题在这里已经有了答案: Adding images in JSfiddle [closed] (3 个回答) 7年前关闭。 我想在 jsfiddle 中使用一个小图像/图标。 我该怎么做?我在某
我曾经能够访问 jsfiddle.net 并加载特定版本的 jquery、angular 或我选择使用的任何库。但现在这一切都过去了。有谁知道发生了什么? :O 最佳答案 在 jsfiddle.net
我一直在使用jsFiddle帮助回答有关 Stack Overflow 的问题,并且一些旧代码/脚本已经开始消失 - 似乎在闲置一定时间后就会过期。 我尝试查看 jsFiddle documentat
jsfiddle 允许在边栏的外部资源 部分导入外部脚本。是否可以在其中导入另一个 jsfiddle 的 javascript? 例如,我可以创建一个名为“A”的 jsfiddle,它创建一个 jav
是否可以选择和复制我在 jsfiddle 中编写的代码? 当我尝试选择代码(Chrome 28.0,Mac OSX)时,一旦我松开鼠标(准鼠标),文本就会被取消选择。 对不起,如果已经有类似的问题,但
我想在 jsFiddle 中展示纯 JavaScript 示例,我只需要一个 JavaScript 窗口和一个控制台。我已经弄清楚如何显示控制台窗口,但是有没有办法删除 HTML 和 CSS 窗口?有
如果我有私有(private)脚本,在“所有 fiddle ”类别中如何将它们移动到“公共(public) fiddle ”类别? 最佳答案 要公开 JSFiddle 脚本: 打开脚本。 打开左侧的“
我刚刚发现了 jsfiddle,我喜欢这个工具并且已经注册了一个帐户。现在我想分享一个我刚刚创建的 fiddle ,但我找不到保存它的网址或按钮,有人能告诉我该怎么做吗?这不可能那么困难,但它让我发疯
在文档中: “保存”或“ fork ”按钮始终出现在用户界面中。如果没有加载 fiddle ,则会出现第一个,后者用于从现有 fiddle 创建一个新 fiddle 。 当 fiddle 是全新的时,
在 jsFiddle 上有什么方法可以将其他用户的公共(public) jsFiddle 代码复制到我的仪表板吗?我可以通过手动复制代码和配置来完成,但我在 jsfiddle.net 上找不到任何选项
我正要问一个关于 JSFiddle 的问题,我注意到图像(我在 Imgur 上得到的)没有出现。如果我直接在浏览器中加载图像,然后重新加载 fiddle ,图片就会显示出来,但如果您尚未加载图片,它们
jsfiddle.net 中有没有办法为代码提供人类可读的名称 片段? 最佳答案 更改 fiddle 名称后无需 fork 您的 fiddle 。您可以使用顶部的 (Set As Base) 选项将其
我真的很喜欢 JSFiddle ,我用了很多。 此刻,我有大约 80 把 fiddle ,我 创建/ fork 在 my JSFiddle dashboard .我要翻8页才能找到具体 用我的眼睛扫视
我认为 jsfiddle 非常简洁,我昨天用它来帮助 stackoverflow 上的某个人。 我创建了一个新 fiddle ,点击“保存”并使用此提供的链接:http://jsfiddle.net/
较早的“设置为基础”按钮在 jsfiddle.net 中。现在它消失了。我使用我的用户名登录。可能是什么原因? 最佳答案 当我在没有登录的情况下开始一个新的 fiddle 时,我遇到了同样的问题(在创
JsFiddle 是我的实验室,但目前一切都停止了,因为我无法在其中工作。我尝试使用为外部链接提供的空间,但无济于事。我什至直接添加了链接,但它仍然不起作用。 我正在进行实验,但无法使其正常工作。将
我试图在 jsFiddle 中包含 Google 字体,但没有成功。我将 URL 添加到“外部资源”,但它包含为 . 这是我想要包含的字体: 最佳答案 Web 字体必须包含在 CSS 象限中,使用
我的简单反网络欺凌插件代码在 JSFiddle 中完美运行,但无法在我的网站上运行,即使我添加了 document.ready 并使用了像 jslint 这样的 c+p 清理器。该代码在 JSFidd
我在这里学习一本书,有一个练习需要 2 个 HTML 文件,我想知道是否可以在我的 JsFidle 中使用 HTML 文件 最佳答案 我不认为这是可能的。但是,您可以使用 Plunker。它非常相似,
我试图了解 Body 标记字段在 JSFiddle 中的作用,但在他们的文档(我能找到)中没有引用它。我问是因为我想控制 body 和 html 标签的 CSS,可能没有样式标签。 最佳答案 文档不是
我是一名优秀的程序员,十分优秀!