关于Marker的标签问题

4 views
Skip to first unread message

luzhiyue

unread,
Jun 5, 2009, 4:45:35 AM6/5/09
to google-map...@googlegroups.com
请问一下在google maps上面的marker,能像googleearth上面一样显示标记的时候旁边就有这个标记的名字显示出来,而不是点击出一个infowindow才能显示相关信息的,如果可以,要怎么设置?

使用新一代 Windows Live Messenger 轻松交流和共享! 立刻下载!

朱鸿正

unread,
Jun 8, 2009, 1:24:01 AM6/8/09
to Google-Map...@googlegroups.com
earth用的是kml里的placemark,可以通过设置placemark的name属性来显示名字,
map的marker没有相关设置,title属性是鼠标焦点落在marker时,才显示的提示信息.
 
不过还可以使用
Chart types for map pins 来度图标进行修改,以显示简短的名字信息,
文档在
 
 
显示图标为:
 
2009/6/5 luzhiyue <zhiyu...@hotmail.com>

luzhiyue

unread,
Jun 8, 2009, 1:43:16 AM6/8/09
to google-map...@googlegroups.com
谢谢,看来这个功能不是那么方便的能加上去的,呵呵
 

Date: Mon, 8 Jun 2009 13:24:01 +0800
Subject: {地图API论坛} Re: 关于Marker的标签问题
From: t850...@gmail.com
To: Google-Map...@googlegroups.com

kvk...@gmail.com

unread,
Jun 8, 2009, 12:12:11 AM6/8/09
to 谷歌地图 API 论坛
function createMarkerRightDiv(index)
{
/*start this*/
/*
mtgt_unnamed_0为mark的ID,其中0为mark的索引。
number:车牌号
divWidth:宽度
divHeight:高度
divClassName:css样式类
*/

var marker_index=index;
var number="654321";
var divWidth="60px";
var divHeight="20px";
var divClassName="marker_vin";

var mDiv=document.getElementById('mtgt_unnamed_'+marker_index);
var mDivLeft=mDiv.style.left;
var mDivTop=mDiv.style.top;

var msgLeft=parseInt(mDivLeft.substring(0,mDivLeft.length-2),10)+20;
var msgTop=parseInt(mDivTop.substring(0,mDivTop.length-2),10)+10;

var mFatherDiv=mDiv.parentNode;
var _msgDiv=document.createElement("div");
_msgDiv.setAttribute("class",divClassName);
var messageNode = document.createTextNode(number);
_msgDiv.appendChild(messageNode);
_msgDiv.style.left=msgLeft+"px";
_msgDiv.style.top=msgTop+"px";
_msgDiv.style.position="absolute";
_msgDiv.style.width=divWidth;
_msgDiv.style.height=divHeight;
_msgDiv.style.background="red";
mFatherDiv.appendChild(_msgDiv);

/*end this*/
}


这样应该行。

On Jun 5, 4:45 pm, luzhiyue <zhiyuelu...@hotmail.com> wrote:
> 请问一下在google maps上面的marker,能像googleearth上面一样显示标记的时候旁边就有这个标记的名字显示出来,而不是点击出一个infowindow才能显示相关信息的,如果可以,要怎么设置?
> _________________________________________________________________
> Messenger安全保护中心,免费修复系统漏洞,保护Messenger安全!http://im.live.cn/safe/
Reply all
Reply to author
Forward
0 new messages