如这个例子:
http://www.google.com/apis/maps/ ... rkerinfowindow.html我是想知道,
1.那个橙红色的圈圈(是叫标记吗) ,如果能定义到我想要的坐标上呢? 这个是随机的吗?
(代码里写着: // 在地图的随机位置添加 5 个标记
// 注意我们并没有把秘密消息添加到标记的实例数据中)
2.鼠标点击的时候,弹出框的内容,我可以自已定义吗?比如:我里面的内容要换行的.甚至是要插进图片的.(代码里写着: function initialize() {
var message = ["这","是","个","秘密","消息"];
我不知道怎么设置这个弹出内容. 希望有朋友可以帮一下忙. 感谢! 其实,我是想做到这种效果. http://www.zbird.com/experience/next
http://www.google.com/apis/maps/ ... rkerinfowindow.html我是想知道,
1.那个橙红色的圈圈(是叫标记吗) ,如果能定义到我想要的坐标上呢? 这个是随机的吗?
(代码里写着: // 在地图的随机位置添加 5 个标记
// 注意我们并没有把秘密消息添加到标记的实例数据中)
2.鼠标点击的时候,弹出框的内容,我可以自已定义吗?比如:我里面的内容要换行的.甚至是要插进图片的.(代码里写着: function initialize() {
var message = ["这","是","个","秘密","消息"];
我不知道怎么设置这个弹出内容. 希望有朋友可以帮一下忙. 感谢! 其实,我是想做到这种效果. http://www.zbird.com/experience/next
2:var er = new GMarker(point);
GEvent.addListener(er, "click", function() {
er.openInfoWindowHtml("你要现实的内容,自己定义!");
其中方式是click,就是说你要点击才会产生效果。。至于你说你想的那个效果,只要把click改为mousemove就行了。。
具体可以参阅http://www.codechina.org/doc/google/gmapapi/#Display_Info_Windows_Above_Markers
希望可以对楼主有帮组~
假如我有要定义10个标记,如下写么.var point = new GLatLng(x1,y1)
var point = new GLatLng(x2,y2)
……
var point = new GLatLng(x10,y10)
--------------------------------------
er.openInfoWindowHtml("内容,1");
er.openInfoWindowHtml("内容,2");
……
er.openInfoWindowHtml("内容,10");
但是这样无效呢, 希望有经验的朋友可以给一点建议我,谢谢!例子如下 :http://www.google.com/apis/maps/documentation/erinfowindow.html
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=abcdefg"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(34.265,108.46), 5);
}
var point = new GLatLng(30.22,120.20);
var er = new GMarker(point);
GEvent.addListener(er, "mouseover", function(){er.openInfoWindowHtml("HangZhou!");}); map.addOverlay(er);
} </script>
</head>
<body onload="load()">
<div id="map" style="width: 1000px; height: 800px"></div>
</body>
</html>试试吧,如果您想多了解Google Map,还是希望多看看Google Maps API中文同步文档
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAmSyaZYJEj-zmAamQg_Fp6BQUdL8CL9NK1APCG9xk56Ma5zl32BTSNGgpdQgj1PRIyxFaQXrkGAHHAA"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(34.265,108.46), 5);
map.setCenter(new GLatLng(30.265,100.46), 4); //第二个标记,不生效,是这样写吗?
}
var point = new GLatLng(30.22,120.20);
var er = new GMarker(point);
GEvent.addListener(er, "mouseover", function(){er.openInfoWindowHtml("HangZhou!");}); GEvent.addListener(er, "mouseover", function(){er.openInfoWindowHtml("ShenZhen!");}); //第二个标记的标注,请问是这样写吗?谢谢!
map.addOverlay(er);
} </script>
</head>
<body onload="load()">
<div id="map" style="width: 1000px; height: 800px"></div>
</body>
</html>假如我想加入第二个标记和标注的时候,请问是这样写吗?谢谢! 小弟是急着需要这么个东西,我不是程序员,希望大家能指点的下,有时间我一定再详细看看,谢谢! 麻烦了!