<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Google Maps JavaScript API Example</title>
  
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg" type="text/javascript"></script>    <style type="text/css">
        #RdsMap
        {
            width: 300px;
            height: 300px;
            background-color: Red;
            overflow: auto;
        }
    </style>    <script type="text/javascript">
        var map;
        function load() {
            map = new GMap2(document.getElementById("RdsMap"));
            //map.setCenter(new GLatLng(113, 22), 13);
            map.setCenter(new GLatLng(113.886505, 22.891595), 13);
            // map.setCenter(new GLatLng(23, 114), 13);
        }
        function test() {
            map.setCenter(new GLatLng(121, 31), 13);
            //map.setCenter(new GLatLng(23, 114), 13);
        }
    </script></head>
<body onload="load()" onunload="GUnload()">
    <input type="button" id="testButton" value="dianji" ondblclick="test()" />
    <div id="RdsMap">
    </div>
</body>
</html>
帮我看看这段代码为什么全是灰的。

解决方案 »

  1.   


    vs有时候是会抽风的,关了再开,也许真能搞定,很有可能就是页面已经变化了,但是vs检查语法的机制没有反应过来。
      

  2.   

     你获取的那个ID是服务器控件还是HTML控件,如果是服务器控件,那么你的那个获取ID的代码应该写成document.getElementId('<%= RdsMap.ClientID %>')
      

  3.   

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="GoogleMap.aspx.cs" Inherits="GoogleMap" %><!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">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0"
                marginwidth="0" 
                src="http://ditu.google.cn/maps?hl=zh-CN&;ie=UTF8&ll=39.103856,117.252381&spn=0.351676,0.571289&z=10&brcurrent=3,0x35edfc63ae81e83b:0xcf58d50ed0002fb5%3B5,0&output=embed&s=AARTsJr5i8WfW5V0UqYQb127Vwz8FPPq-Q">
            </iframe>
            <br />
            <small><a href="http://ditu.google.cn/maps?hl=zh-CN&;ie=UTF8&ll=39.103856,117.252381&spn=0.351676,0.571289&z=10&brcurrent=3,0x35edfc63ae81e83b:0xcf58d50ed0002fb5%3B5,0&source=embed"
                style="color: #0000FF; text-align: left">查看大图</a></small>
        </div>
        </form>
    </body>
    </html>