Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박정인
/
opensource
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박정인
2017-12-06 21:38:04 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c5dc5fe3cc43fb83cfbdc21e37a1db3c2349b29b
c5dc5fe3
1 parent
7ec21dc0
result
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
0 deletions
about.html
about.html
0 → 100644
View file @
c5dc5fe
<!DOCTYPE html >
<head>
<meta
name=
"viewport"
content=
"initial-scale=1.0, user-scalable=no"
/>
<meta
http-equiv=
"content-type"
content=
"text/html; charset=UTF-8"
/>
<title>
Using MySQL and PHP with Google Maps
</title>
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map
{
height
:
100%
;
}
/* Optional: Makes the sample page fill the window. */
html
,
body
{
height
:
100%
;
margin
:
0
;
padding
:
0
;
}
</style>
</head>
<body>
<div
id=
"map"
></div>
<script>
var
customLabel
=
{
Seochogu
:
{
label
:
'R'
},
Seongdonggu
:
{
label
:
'B'
}
Gwanakgu
:
{
label
:
'G'
}
Gangnamgu
:
{
label
:
'G'
}
};
function
initMap
()
{
var
map
=
new
google
.
maps
.
Map
(
document
.
getElementById
(
'map'
),
{
center
:
new
google
.
maps
.
LatLng
(
37.551920
,
127.994615
),
zoom
:
12
});
var
infoWindow
=
new
google
.
maps
.
InfoWindow
;
// Change this depending on the name of your PHP or XML file
downloadUrl
(
'http://127.0.0.1/test.xml'
,
function
(
data
)
{
var
xml
=
data
.
responseXML
;
var
markers
=
xml
.
documentElement
.
getElementsByTagName
(
'marker'
);
Array
.
prototype
.
forEach
.
call
(
markers
,
function
(
markerElem
)
{
var
name
=
markerElem
.
getAttribute
(
'name'
);
var
address
=
markerElem
.
getAttribute
(
'address'
);
var
type
=
markerElem
.
getAttribute
(
'type'
);
var
point
=
new
google
.
maps
.
LatLng
(
parseFloat
(
markerElem
.
getAttribute
(
'lat'
)),
parseFloat
(
markerElem
.
getAttribute
(
'lng'
)));
var
infowincontent
=
document
.
createElement
(
'div'
);
var
strong
=
document
.
createElement
(
'strong'
);
strong
.
textContent
=
name
infowincontent
.
appendChild
(
strong
);
infowincontent
.
appendChild
(
document
.
createElement
(
'br'
));
var
text
=
document
.
createElement
(
'text'
);
text
.
textContent
=
address
infowincontent
.
appendChild
(
text
);
var
icon
=
customLabel
[
type
]
||
{};
var
marker
=
new
google
.
maps
.
Marker
({
map
:
map
,
position
:
point
,
label
:
icon
.
label
});
marker
.
addListener
(
'click'
,
function
()
{
infoWindow
.
setContent
(
infowincontent
);
infoWindow
.
open
(
map
,
marker
);
});
});
});
}
function
downloadUrl
(
url
,
callback
)
{
var
request
=
window
.
ActiveXObject
?
new
ActiveXObject
(
'Microsoft.XMLHTTP'
)
:
new
XMLHttpRequest
;
request
.
onreadystatechange
=
function
()
{
if
(
request
.
readyState
==
4
)
{
request
.
onreadystatechange
=
doNothing
;
callback
(
request
,
request
.
status
);
}
};
request
.
open
(
'GET'
,
url
,
true
);
request
.
send
(
null
);
}
function
doNothing
()
{}
</script>
<script
async
defer
src=
"https://maps.googleapis.com/maps/api/js?key=AIzaSyDxV4OE9LULUMIYriVBLqR23YNGsZ_YgkI&callback=initMap"
>
</script>
</body>
</html>
Please
register
or
login
to post a comment