- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <script type="text/javascript" src1="http://211.136.131.242:8087/api/map.js?key=您的密钥"></script>
- <title>图片标注</title>
- <style type="text/CSS">
- body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
- </style>
- </head>
- <body>
- <div id="div_map" style="width:100%;height:100%;"></div>
- <script type="text/javascript">
- var map=null;
- map=new STMapObj("div_map");
- map.locateMap(new STMapPoint(121.476324,31.22717),3);
- LocationPoint();
- function LocationPoint(){
- var poly = new STMapMarker();
- poly.id="testline6"; //【必选】对象 id
- poly.point=new STMapPoint(121.47727877909848,31.227720161691113); //【必选】经纬度坐标 STMapPoint 类型
- poly.img="../img/carAPI.png"; //【必选】对象的图片地址 url
- poly.label=""; //【可选】鼠标提示
- poly.size="" //【可选】图片长宽 参数为 STMapSize 类型,默认为图片本身尺寸
- poly.anchor="TR" // 【可选】定位锚点,BC (下边中心点)BL (左下角)BR (右下角)TL (左上角)TC (上边中心点)TR (右上角)ML (左边中心点)MR (右边中心点)CENTER (图片中心点)
- poly.infowin=true; //【可选】是否点击显示信息窗口,默认为 true。
- poly.title=""; //属性信息库标题,支持 html 代码
- poly.content="我是的添加的图片"; //属性信息框内容,支持 html 代码
- poly.moveable = false; //是否可以拖动
- map.addOverlay(poly);
- }
- </script>
- <div style="display: none">
- <script type="text/javascript">
- var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
- document.write(unescape("%3Cspan id='cnzz_stat_icon_1000501913'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s11.cnzz.com/z_stat.php%3Fid%3D1000501913' type='text/javascript'%3E%3C/script%3E"));
- </script>
- </div>
- </body>
- </html>
- //该片段来自于http://www.codesnippet.cn/detail/0809201513641.html
来源: http://www.codesnippet.cn/detail/0809201513641.html