zoukankan      html  css  js  c++  java
  • 谷歌位置搜索 蹩脚结合jquery.ui.gmap

    http://gmaps-samples-v3.googlecode.com/svn/trunk/localsearch/places.html

     var gLocalSearch = new GlocalSearch();
        gLocalSearch.setSearchCompleteCallback(null, OnLocalSearch);
        function OnLocalSearch() {
            if (!gLocalSearch.results) {
                window.alert("未找到,请手工查找");
                return;
            }
            //debugger;
            //console.log(gLocalSearch.results[0]);
            var result = gLocalSearch.results[0];
            var lat =result.lat;//$(item).attr("lat");
            var lng = result.lng;//$(item).attr("lng");
            var latlng = new google.maps.LatLng(lat, lng);
            $('#map_canvas').gmap('addMarker', {
                'position': latlng,
                'bounds': true,
                'draggable': true
            }, function (map, marker) {
                $('#map_canvas').gmap('get', 'map').setOptions({ 'center': latlng ,  'draggable': true});
                setTimeout(function () {
                    $('#map_canvas').gmap('option', 'zoom', 15);
                }, 1000);
            }).click(function () {
            });
        }

    function Search() {
            var text = '';
    
            if ($('#selectcounty').val() != '') {
                text += $("#selectcounty option:selected").text()+' ';
    
            }  
            if ($('#selectcity').val() != '') {
                text += $("#selectcity option:selected").text()+' ';
    
            }
            if ($('#selectprovince').val() != '') {
                text += $("#selectprovince option:selected").text()+' ';
            }
                
            text += $('#detailaddress').val();
                
                
            gLocalSearch.execute(text);
        }
  • 相关阅读:
    4.22 每日一题题解
    4.21 每日一题题解
    4.20 每日一题题解
    【HDU2825】Wireless Password【AC自动机,状态压缩DP】
    【POJ2778】DNA Sequence 【AC自动机,dp,矩阵快速幂】
    【ZOJ 3228】Searching the String 【AC自动机】
    【LA5135 训练指南】井下矿工 【双连通分量】
    【LA3523 训练指南】圆桌骑士 【双连通分量】
    【LA3713 训练指南】宇航员分组 【2-sat】
    【LA3211 训练指南】飞机调度 【2-sat】
  • 原文地址:https://www.cnblogs.com/zbw911/p/3065326.html
Copyright © 2011-2022 走看看