ola, tenho um blog e estou tentando colocar um widget google maps v3 com marcadores…
Mas o MAPA nao aparece =s
quando salvo um index.html com o codigo no meu pc e executo o arquivo ele funciona, mas no blog nao. pq?
o que eu preciso fazer?
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
Google Maps JavaScript API v3 Example: Map Simple
<style type="text/css">
.location_txt{
font-family:Helvetica;
text-decoration:none;
color: #333;
font-size:14px;
}
#list_locations a:hover{
color: #963;
}
.sno{
clear:both;
float:left;
width:20px;
text-align:right;
}
.location_title{
float:left;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?key=AIzaSyBWBYBUi71-l58uz4jrftlINhpHXLYjJBk&sensor=false"></script>
<script type="text/javascript">
var map;
var markersArray = [];
var contentString;
var locationsArray = new Array();
locationsArray[0] = { 'title':'Carver\'s Steakhouse',
'lat':'52.126788',
'lng':'-106.659017',
'infostring':'612 Spadina Crescent East<br/>Saskatoon, SK S7K 3G8, Canada<br/>(306) 652-8292<br/><a href="http://www.carverssteakhouse.ca" target="_blank">http://www.carverssteakhouse.ca</a>' };
locationsArray[1] = { 'title':'6Twelve Lounge',
'lat':'52.126403',
'lng':'-106.659341',
'infostring':'612 Spadina Crescent East<br/>Saskatoon, SK S7K 3G9, Canada<br/>(306) 652-6770<br/><a href="http://www.6twelve.ca" target="_blank">http://www.6twelve.ca</a>' };
locationsArray[2] = { 'title':'Starbucks in The Sheraton Cavalier',
'lat':'52.126885',
'lng':'-106.659055',
'infostring':'612 Spadina Crescent East<br/>Saskatoon<br/>SK S7K 3G9<br/>Canada<br/>(306) 652-6770' };
locationsArray[3] = { 'title':'Meewasin Outdoor Skating Rink',
'lat':'52.126829',
'lng':'-106.657612',
'infostring':'612 Spadina Crescent East<br/>Saskatoon, SK S7K 3G8, Canada<br/>(306) 652-8292' };
locationsArray[4] = { 'title':'Spadina Free House',
'lat':'52.126667',
'lng':'-106.659401',
'infostring':'608 Spadina Crescent East<br/>Saskatoon, SK S7K 3G8, Canada<br/>(306) 668-1000' };
locationsArray[5] = { 'title':'The Make Up Studio and Spa',
'lat':'52.126477',
'lng':'-106.659801',
'infostring':'612 Spadina Crescent East<br/>Saskatoon, SK S7K 3G8, Canada' };
locationsArray[6] = { 'title':'Shearwater River Cruises',
'lat':'52.133889',
'lng':'-106.648321',
'infostring':'Spadina Crescent East<br/>Saskatoon, SK S7K 3H6, Canada<br/>(306) 549-2454' };
locationsArray[7] = { 'title':'Persephone Theatre',
'lat':'52.12329',
'lng':'-106.666943',
'infostring':'100 Spadina Crescent East<br/>Saskatoon, SK S7K 0L3, Canada<br/>(306) 384-7727<br/>persephonetheatre.org'};
locationsArray[8] = { 'title':'Mendel Art Gallery',
'lat':'52.134858',
'lng':'-106.649369',
'infostring':'950 Spadina Cres E<br/>Saskatoon, SK S7K 3H6, Canada<br/>(306) 975-7610<br/>mendel.ca' };
locationsArray[9] = { 'title':'University of Saskatchewan',
'lat':'52.134822',
'lng':'-106.641111',
'infostring':'105 Administration Place<br/>Saskatoon, SK S7N 5A2, Canada<br/>(306) 966-4343' };
locationsArray[10] = { 'title':'Riverstone Massage Therapy',
'lat':'52.130075',
'lng':'-106.657627',
'infostring':'241 5th Avenue North<br/>Saskatoon, SK S7K 2P3, Canada<br/>(306) 955-4311<br/>riverstonemassagetherapy.com' };
locationsArray[11] = { 'title':'The Bassment',
'lat':'52.130174',
'lng':'-106.659242',
'infostring':'202 4 Avenue North<br/>Saskatoon, SK S7K 0J5, Canada<br/>(306) 683-2277<br/>saskatoonjazzsociety.com' };
locationsArray[12] = { 'title':'Rouge Gallery',
'lat':'52.12656',
'lng':'-106.662919',
'infostring':'208 3rd Ave S<br/>Saskatoon, SK S7K 1L9, Canada<br/>(306) 955-8882<br/>rougegallery.ca' };
locationsArray[13] = { 'title':'Souleio Foods Inc.',
'lat':'52.125714',
'lng':'-106.66363',
'infostring':'265 3rd Ave South<br/>Saskatoon, SK S7K 1M3, Canada<br/>(306) 979-8103<br/>souleio.com' };
locationsArray[14] = { 'title':'Tusq Restaurant & Staqatto Piano Bar',
'lat':'52.126402',
'lng':'-106.660213',
'infostring':'416 21 Street East<br/>Saskatoon, SK S7K 0C2, Canada<br/>(306) 244-8877<br/>tusq.ca' };
locationsArray[15] = { 'title':'Truffles Bistro',
'lat':'52.126954',
'lng':'-106.663339',
'infostring':'230 21 Street East<br/>Saskatoon, SK, Canada<br/>(306) 373-7779<br/>www.trufflesbistro.ca/' };
locationsArray[16] = { 'title':'O\'Shea\'s Irish Pub',
'lat':'52.127152',
'lng':'-106.664462',
'infostring':'222 2 Avenue South<br/>Saskatoon, SK, Canada<br/>(306) 384-7444<br/>http://osheasirishpub.ca' };
locationsArray[17] = { 'title':'Midtown Plaza',
'lat':'52.127473',
'lng':'-106.666311',
'infostring':'201 1 Avenue South<br/>Saskatoon, SK S7K 8B4, Canada<br/>(306) 653-8844<br/>midtownplaza.ca' };
locationsArray[18] = { 'title':'TCU Place',
'lat':'52.129201',
'lng':'-106.666819',
'infostring':'35 22nd Street East<br/>Saskatoon, SK S7K 0C8, Canada<br/>(306) 975-7777<br/>tcuplace.com' };
locationsArray[19] = { 'title':'Galaxy Movie Theatres',
'lat':'52.124834',
'lng':'-106.66583',
'infostring':'347-2nd Avenue South<br/>Saskatoon, SK S7K 1L1, Canada<br/>(306) 664-5060<br/>cineplex.com' };
locationsArray[20] = { 'title':'Damara Day Spa',
'lat':'52.126163',
'lng':'-106.659141',
'infostring':'Delta Bessborough<br/>601 Spadina Crescent East<br/>Saskatoon, SK S7K 3G8, Canada<br/>(306) 244-5521<br/>http://www.deltahotels.com' };
locationsArray[21] = { 'title':'Hudson\'s Tap House',
'lat':'52.12655',
'lng':'-106.66113',
'infostring':'401-21st Street East Saskatoon<br/>Saskatchewan, S7K OC5, Canada<br/>(306) 974-0944<br/>http://www.hudsonstaphouse.com/city/saskatoon/' };
/*locationsArray[19] = { 'title':'Broadway Shopping District',
'lat':'52.118666',
'lng':'-106.65667',
'infostring':'715 Broadway Ave<br/>Saskatoon, Saskatchewan, Canada<br/>(306) 384-3456<br/>broadwaytheatre.ca' };*/
//var infowindow = new Array();
var infowindow = new google.maps.InfoWindow();
function initialize() {
var myLatlng = new google.maps.LatLng(52.127353,-106.658833);
var centerLatlng = new google.maps.LatLng(52.127402,-106.660213);
var myOptions = {
zoom: 14,
center: centerLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
contentString = '<div id="content">'+
'<h3 style="padding:0; margin:0;">The James Hotel</h3>'+
'620 Spadina Crescent East<br/> ' +
'Saskatoon, SK<br/>'+
'S7K 3T5<br/>'+
'T: 855-244-6446<br/>'+
'P: (306) 244-6446<br/>'+
'F: (306) 244-6642<br/>'+
'info@thejameshotel.ca'+
'</div>';
infowindow.setContent(contentString);
var image = new google.maps.MarkerImage(
'tj.png',
new google.maps.Size(60,32),
new google.maps.Point(0,0),
new google.maps.Point(8,5)
);
var shadow = new google.maps.MarkerImage(
'shadow.png',
new google.maps.Size(71,45),
new google.maps.Point(0,0),
new google.maps.Point(23,45)
);
var marker = new google.maps.Marker({ position: myLatlng,
map:map,
icon:image,
zIndex: 10 });
google.maps.event.addListener(marker, 'click', function() {
if (infowindow) infowindow.close();
infowindow.setContent(contentString);
infowindow.open(map,marker); });
marker.setMap(map);
var sno = 1;
var shadow1 = new google.maps.MarkerImage(
'http://chart.apis.google.com/chart?chst=d_map_pin_shadow',
new google.maps.Size(40,37),
new google.maps.Point(0,0),
new google.maps.Point(12,35)
);
for (i in locationsArray)
{
var myLatlng = new google.maps.LatLng(locationsArray[i]['lat'],locationsArray[i]['lng']);
markersArray[i] = new google.maps.Marker({ position: myLatlng,
map:map,
zIndex: 1,
flat: false,
icon: "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld="+ sno +"|CCCCCC|000000",
shadow: shadow1 });
//infowindow = new google.maps.InfoWindow({ content: locationsArray[i]['title'] + '<br/>' + locationsArray[i]['infostring'] });
//infowindow[i] = new google.maps.InfoWindow({ content: locationsArray[i]['title'] + '<br/>' + locationsArray[i]['infostring'] });
google.maps.event.addListener(markersArray[i], 'click', makeInfoWindowListener(markersArray[i],i));
sno = sno + 1;
}
showOverlays();
}
function makeInfoWindowListener (pMarker,i)
{
return function() { 6
if (infowindow) infowindow.close();
infowindow.setContent('<b>' + locationsArray[i]['title'] + '</b><br/>' + locationsArray[i]['infostring']);
infowindow.open(map,pMarker);
};
}
// Shows any overlays currently in the array
function showOverlays()
{
if (markersArray)
{
for (i in markersArray)
{
markersArray[i].setMap(map);
}
}
}
// This function picks up the click and opens the corresponding info window
function myclick(i) {
google.maps.event.trigger(markersArray[i], "click");
}
</script>
<div style="float:left;width:290px;" id="list_locations" class="location_txt">
<script type="text/javascript">
var sno = 1;
for (i in locationsArray)
{
document.write( '<div class="sno">' + sno + '.</div><div class="location_title"> <a class="location_txt" href="javascript:;" onClick="myclick(' + i + ');">'+locationsArray[i]['title']+'</a></div><br/>');
sno = sno + 1;
}
</script>
</div>
<div id="map_canvas"></div>
obrigada, veronica.