大家应该知道“大众点评”这个网站吧,里面有个地图,下面可以点击查看全图,而我的网站就一块小地图,不能放大,我想实现跟那个地图效果一样的,点击查看全图的效果,不知道怎么做,哪位高手知道的,谢谢!!!

解决方案 »

  1.   

    http://www.dianping.com/shop/2703961?KID=22264  这个是大众点评的网站,里面有个地图,看看
      

  2.   

    调用GG地图。
    DEMO
      

  3.   


    var mapstr="39.884514;116.431000@@北京天坛饭店#398#1#104328|39.941006;116.389824@@北京后海(大华卫)怡景酒店#450#2#154391|39.906776;116.444206@@北京欣燕都旅馆连锁建国门店-经济型#280#3#104744|39.904724;116.443451@@北京丽舍酒店式公寓(LuxuryServicedResidenceBeijing)#492#4#117324|39.923885;116.439217@@北京光耀酒店#550#5#135035|39.878082;116.424911@@北京市交通饭店#238#6#105260|39.921192;116.377296@@北京锦江之星西单店#247#7#140577|39.912701;116.371468@@北京西单饭店#268#8#122145|39.928997;116.409081@@北京荣丰假日酒店#139#9#168822|39.890797;116.407600@@格林豪泰北京天坛北门酒店#174#10#168728|39.918278;116.421715@@北京华福新龙宾馆#180#11#104346|39.917152;116.420845@@中国红十字会宾馆(北京)#198#12#122409|39.888302;116.405243@@北京天坛万程酒店#207#13#127524|39.931313;116.417847@@北京飘HOME东四店#140#14#146000|39.918449;116.419266@@北京好园宾馆#600#15#134908|39.9090038;116.3974857@@天安门#0#0#0";function initmap(C, B) {
        if (mapstr === "") {
            return false
        }
        if (GBrowserIsCompatible()) {
            map = new GMap2(document.getElementById(C));
            map.addControl(new GSmallMapControl());
            map.addControl(new GScaleControl(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT));
            var G = mapstr.split("|");
            var I = new GIcon();
            I.iconSize = new GSize(22, 22);
            I.iconAnchor = new GPoint(9, 34);
            I.infoWindowAnchor = new GPoint(9, 2);
            I.infoShadowAnchor = new GPoint(18, 25);
            function J(M, L, P) {
                var Q = new GIcon(I);
                if (C == "ditu") {
                    Q.image = "/images/map/1/" + P[2] + ".gif";
                    Q.iconSize = new GSize(22, 22);
                    opts = {icon:Q,title:P[0]};
                    var O = new GMarker(L, opts)
                } else {
                    if (C == "bigditu") {
                        Q.image = "/images/map/3/" + P[2] + ".png";
                        if (P[2] > 0) {
                            Q.iconSize = new GSize(80, 26);
                            opts = {icon:Q,clickable:true,title:P[0],labelText:'<font color="#FF6600">¥' + P[1] + "</font>",labelOffset:new GSize(20, -31)}
                        } else {
                            Q.iconSize = new GSize(22, 22);
                            opts = {icon:Q,labelText:P[0],labelClass:"dmap",title:P[0],labelOffset:new GSize(10, -32)}
                        }
                        var O = new LabeledMarker(L, opts)
                    }
                }
                if (C == "ditu") {
                    if (P[3] > 0) {
                        GEvent.addListener(O, "click", function() {
                            window.open("/r_" + P[3])
                        });
                        GEvent.addListener(O, "mouseover", function() {
                            O.setImage("/images/map/2/" + P[2] + ".gif");
                            this.Er.style.zIndex = 1
                        });
                        GEvent.addListener(O, "mouseout", function() {
                            O.setImage("/images/map/1/" + P[2] + ".gif");
                            this.Er.style.zIndex = 0
                        })
                    }
                } else {
                    if (C == "bigditu") {
                        if (P[3] > 0) {
                            GEvent.addListener(O, "click", function() {
                                O.openExtInfoWindow(map, "kxmap", infoWindow(P), {beakOffset:13})
                            });
                            GEvent.addListener(O, "mouseover", function() {
                                O.setImage("/images/map/3/" + P[2] + "-2.png");
                                this.div_.style.zIndex = 1;
                                this.Er.style.zIndex = 1
                            });
                            GEvent.addListener(O, "mouseout", function() {
                                O.setImage("/images/map/3/" + P[2] + ".png");
                                this.div_.style.zIndex = 0;
                                this.Er.style.zIndex = 0
                            })
                        }
                    }
                }
                var N = {};
                N.point = L;
                N.er = O;
                N.imgsrc = "/images/map/1/" + P[2] + ".gif";
                ermap[M] = N;
                return O
            }        var A = new GLatLngBounds();
            for (i = 0; i < G.length; i++) {
                var E = G[i].split("@@");
                var H = E[0].split(";");
                if (H[0] != 0) {
                    if (hotelid == 0) {
                        hotelid = E[0]
                    }
                    var D = E[1].split("#");
                    mapdata[E[0]] = D;
                    var K = new GLatLng(H[0], H[1]);
                    A.extend(K);
                    var F = J(E[0], K, D);
                    map.addOverlay(F);
                    hm[i] = F
                }
            }
            if (B && B.center) {
                map.setCenter(B.center, B.zoom)
            } else {
                map.setCenter(A.getCenter(), map.getBoundsZoomLevel(A))
            }
            if (C == "bigditu") {
                $("#zb").show();
                $("#kx_search").show()
            }
        }
    }
      

  4.   

    楼上发的这个,我不知道怎么加,我的是这样写的,大侠们帮看看
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> 
    <head> 
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 
        <title>Geocoding</title>     <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=your api key" 
            type="text/javascript"></script>     <script type="text/javascript">     var map = null; 
        var geocoder = null; 
        var er; 
         
        function initialize()  
        { 
            if (GBrowserIsCompatible())  
            { 
                map = new GMap2(document.getElementById("map")); 
                map.addControl(new GLargeMapControl());                 //加入地圖縮放工具 
                map.addControl(new GMapTypeControl());                 //加入地圖切換的工具 
                map.addMapType(G_PHYSICAL_MAP);                         //加入地形圖 
              map.setCenter(new GLatLng(31.22, 121.48), 9);   //設定上海為中心點 
                geocoder = new GClientGeocoder(); 
            } 
        }     function createMarker(point,title,html)  
        { 
            var er = new GMarker(point); 
             
            GEvent.addListener(er, "click", function()  
            { 
                er.openInfoWindowHtml( 
                    html, 
                    { 
                        maxContent: html, 
                        maxTitle: title} 
                    ); 
            }); 
            return er; 
        } 
         
        function showAddress(address)  
        { 
            if (geocoder)  
            { 
                geocoder.getLatLng( 
                    address, 
                    function(point)  
                    { 
                        if (!point)  
                        { 
                            alert(address + " not found"); 
                        }  
                        else  
                        { 
                            if(er)  //移除上一個點 
                            { 
                                map.removeOverlay(er); 
                            } 
                             
                            map.setCenter(point, 13); 
                             
                            var title = "地址"; 
                             
                            er = createMarker(point,title,address);                         map.addOverlay(er);                         er.openInfoWindowHtml( 
                                address, 
                                { 
                                    maxContent: address, 
                                    maxTitle: title} 
                                ); 
                        } 
                    } 
                ); 
            } 
        } 
        </script> </head> 
    <body onload="initialize()" onunload="GUnload()"> 
        <form action="#" onsubmit="showAddress(this.address.value); return false"> 
            <p> 
                <input type="text" size="60" name="address" value="上海市" /> 
                <input type="submit" value="Go!" /> 
            </p> 
            <div id="map" style="width: 500px; height: 300px"> 
            </div> 
        </form> 
    </body> 
    </html>
      

  5.   

    官方的demo上面很全的
    看两个小时就会用了