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);
        }
  • 相关阅读:
    python 和 R 语言中的等差数列
    python 用 matplotlib 绘制误差条图
    Python 模拟伯努利试验和二项分布
    R 基于朴素贝叶斯模型实现手机垃圾短信过滤
    PCA 在手写数字数据集上的应用
    R 实现朴素贝叶斯分类器模型
    R语言 绘制正(余)弦图
    R 绘制反正(余)弦图像
    R 绘制正(余)切图像
    R 语言 do.call() 函数
  • 原文地址:https://www.cnblogs.com/zbw911/p/3065326.html
Copyright © 2011-2022 走看看