谷歌地图 api 方向 javascript 变量
由于地图上标记的信息窗口,我在加载地图时遇到错误。在信息窗口中,我想要一个指示链接,因此我要在 URL 中传递目的地坐标。但它不喜欢我使用的语法,但我没有收到任何错误。
var contentString2 = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h3 id="firstHeading" class="firstHeading"><a name="FLOSSMOOR STATION RESTAURANT & BREWERY"></A><strong><A HREF="redirect.cfm?address=http://www.flossmoorstation.com" TARGET="_blank">FLOSSMOOR STATION RESTAURANT & BREWERY</A></strong></h3>'+
'<div id="bodyContent">'+
'<p><a href="index.cfm?in='document.write(initialLocation);'+'&'+'document.write(myLatlng2);'+'">Directions</a></p>'+
'</div>'+
'</div>';
使用信息窗口的这个变量,我会在没有地图加载的情况下得到可爱的灰色屏幕,还有更好的方法来制作信息窗口 div 吗?谢谢!
I am running into an error loading my map because of my info window for a marker on my map. In the info window I want a link for the directions, so I was going to pass the destination coordinates in the URL. But it does not like the syntax I am using, I am getting no errors though.
var contentString2 = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h3 id="firstHeading" class="firstHeading"><a name="FLOSSMOOR STATION RESTAURANT & BREWERY"></A><strong><A HREF="redirect.cfm?address=http://www.flossmoorstation.com" TARGET="_blank">FLOSSMOOR STATION RESTAURANT & BREWERY</A></strong></h3>'+
'<div id="bodyContent">'+
'<p><a href="index.cfm?in='document.write(initialLocation);'+'&'+'document.write(myLatlng2);'+'">Directions</a></p>'+
'</div>'+
'</div>';
with this variable for the info window I get the lovely grey screen with out the map loading, also is there a better way going about making the info-window div? thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果
myLatlng2
是 Google Maps API v3 中的 LatLng 对象,那么您至少应该在 URL 构造中对此进行更改:更像这样:
If
myLatlng2
is a LatLng object in Google Maps API v3 then you should likely at a minimum change this in your URL construction:To something more like this: