sg

Perşembe, Aralık 08, 2005

Re: How to add markers ?


Somewhere there needs to be something that knows which markers are
associated with each click. Whatever that something is, it can pass that
information tot he function that performs the clearOverlay() and
addOverlay()s.

There are several methods that would work

(1) You can pass an array of marker numbers from HTML to the Javascript
function:

<a href="javascript:sideBarClick([123,124,125,127,135])">Click This</a>
. . .

<script type="text/javascript">
sideBarClick(thelist) = function {
map.clearOverlays();
for (var i=0; i<thelist.length; i++) {
map.addOverlay(gmarkers[thelist[i]]);
}
}
</script>

(2) You can have assign some sort of index to your queries, pass the
index from HTML to Javascript and have something that finds the markers
associated with that query

<a href="javascript:sideBarClick(1)">Click This</a>
. . .

<script type="text/javascript">
sideBarClick(queryNumber) = function {
map.clearOverlays();
var thelist = performQuery(queryNumber);
for (var i=0; i<thelist.length; i++) {
map.addOverlay(gmarkers[thelist[i]]);
}
}
</script>

(3) You can assign a property to each of your markers when you create
them that determines which query they respond to.

<a href="javascript:sideBarClick(1)">Click This</a>
. . .

<script type="text/javascript">
sideBarClick(queryNumber) = function {
map.clearOverlays();
for (var i=0; i<gmarkers.length; i++) {
if (gmarkers[i].query == queryNumber) {
map.addOverlay(gmarkers[i]);
}
}
}
</script>

--
The Blackpool Community Church Javascript Team
http://www.econym.demon.co.uk/googlemaps/

0 Comments:

Yorum Gönder

<< Home


Komik Videolar   islam  şarkı sözleri  yemek tarifleri  gelibolu  huzur   sağlık