SOSO地图JS画出标注和中心点以html形式运行
2013-08-09 00:00
246 查看
直接贴出代码,这个可以在本地创建一个html文件直接运行:
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Map</title> <script charset="utf-8" src="http://map.soso.com/api/v2/main.js"></script> <script> function init() { var center = new soso.maps.LatLng(31.15953,121.516035); var map = new soso.maps.Map( document.getElementById("container"), { center: center,//显示地图的中心位置 zoom: 15//显示地图的缩放级别 } ); //地图第一个mark的坐标 var position1 = new soso.maps.LatLng(31.15751,121.514061); var marker = new soso.maps.Marker({ position: position1, map: map }); //地图第二个mark的坐标 var position2 = new soso.maps.LatLng(31.160705,121.524017); var marker = new soso.maps.Marker({ position: position2, map: map }); } function loadScript() { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "http://map.soso.com/api/v2/main.js?callback=init"; document.body.appendChild(script); } window.onload = loadScript; </script> </head> <body onload="init()"> <div id="container" style="width:1000px; height:800px"></div> </body> </html>
相关文章推荐
- TF:TF之Tensorboard实践:将神经网络Tensorboard形式得到events.out.tfevents文件+dos内运行该文件本地服务器输出到网页可视化—Jason niu
- android UiAutomator如何把运行结果写到html文档里
- html页面加载完毕时运行某个js脚本
- vue-cli打包之后的dist文件无法运行index.html
- 将Tomcat解压缩版变成服务形式运行,并修改Tomcat的启动内存参数
- 网页上自定义运行和测试HTML脚本
- 以图片的中心为基准,按照任意尺寸自动调整大小并截取出规定的素材,保存为缩略图或以php形式输出为图片
- thinkphp 后台控制器写Excel导出html形式,html混合php
- 程序以html形式发送邮件注意问题
- Python实现抓取HTML网页并以PDF文件形式保存的方法
- 以内存形式运行Xcode
- 开源javascript/html/css的在线运行和调试 - editr
- HTML网页中插入输入框,输入框内容或代码可点击"运行代码"运行,在浏览器看到运行输入框内代码效果。此HTML代码由表单代码textarea和简单JS代码实现。 HTML代码: <textarea n
- 不用命令行的形式运行agent
- 解决htmlfile: 未知的运行时错误
- HTML代码中,加这段声明 就可以 用IE7的方式 解析了,让IE8始终以IE7兼容模式运行网页
- 「JavaScript」梅花雪日历控件3.0-直接复制代码保存为html格式即可运行
- Tomcat容器运行静态资源(html、css)乱码问题
- .net运行项目的几种形式