学习 地图

http://developer.baidu.com/map/jsdemo.htm#a1_2

http://www.open-open.com/lib/view/open1337224207697.html

 http://lbs.qq.com/javascript_v2/doc/marker.html

QQMAP

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title></title>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }
        html{width:100%;}
        body{

            width:100%;
        }
        #container{
            width:500px;
            height:500px;
        }
    </style>
    <script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp"></script>

</head>
<body>
    <div id="container"></div>
        <tr>
            <td align="right">地图坐标:</td>
            <td>
                <input id="Location_X" />
                <input id="Location_Y" />
                
            </td>
        </tr>
        <script>

            function init() {
                var center = new qq.maps.LatLng(39.137807, 117.212104);
                var map = new qq.maps.Map(document.getElementById("container"), {
                    center: center,
                    zoom: 16
                });
                //给map绑定mousemove事件
                var label = new qq.maps.Label({
                    offset: new qq.maps.Size(15, 0)
                });
                qq.maps.event.addListener(map, "mousemove", function (e) {
                    label.setContent(e.latLng.toString());
                    label.setPosition(e.latLng);
                });
                qq.maps.event.addListener(map, "mouseover", function (e) {
                    label.setMap(map);
                });
                qq.maps.event.addListener(map, "mouseout", function (e) {
                    label.setMap(null);
                });
                qq.maps.event.addListener(map, "click", function (e) {
                    $("#Location_X").val(e.latLng.lat);
                    $("#Location_Y").val(e.latLng.lng);
                    $("#container").hide();
                });
            }
            window.onload = init;

        </script>
</body>
</html>

 http://lbs.qq.com/javascript_v2/demo.html

posted @ 2016-03-10 16:13  lunawzh  阅读(177)  评论(0编辑  收藏  举报