0

Trying to attach map from tutorial "https://developers.google.com/maps/tutorials/fundamentals/adding-a-google-map#the_basic_html_page", into simple page, but getting error "Object # has no method 'setValues" in browser console. My code is exact the same as in tutorial, only id is different.

    <script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"></script>
    <script>
        function Initialize() {
            var mapCanvas = document.getElementById('map-canvas');
            var mapOptions = {
                center: new google.maps.LatLng(49.8103, 23.8584),
                zoom: 8,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = google.maps.Map(mapCanvas, mapOptions);
        }
        google.maps.event.addDomListener(window, 'load', Initialize);
    </script>
<div id="map-canvas"></div>

Can somebody help me to figure out, why this isn't working for me? Thanks in advance.


C# Display Special Characters in TextBlock

In my Windows Phone application, I take RSS from Internet and I parse XML. I take out Title and Description from rss, and display them in a TextBlock.

Here I find some problems, the speacial characters are substituted by rhombus contain "?".

      /*CONNECTION AND DOWNLOAD RSS*/ 
        WebClient wc = new WebClient();
        wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(load_web_news);
        wc.DownloadStringAsync(new Uri("http://.../rssFeedNews.asp"));
        ....
     /*SAVE RSS*/
            TextBlock tbTitle = new TextBlock();
            Run rTitle = new Run();
            rTitle.Text = rss.Title;
            Run rDescription = new Run();
            rDescription.Text = rss.Description;
            tbTitle.Inlines.Add(rTitle);
        ....
       /*PARSING*/  
    private void load_web_news(object sender, DownloadStringCompletedEventArgs e)
    {
        XElement xmlitems = XElement.Parse(e.Result);
        List<XElement> elements = xmlitems.Descendants("item").ToList();
        foreach (XElement rssItem in elements)
                {
                    RSSItem rss = new RSSItem();
                    rss.Description1 = rssItem.Element("description").Value;
                    String title = rssItem.Element("title").Value;

How to display special chars for example "à" "è" "°" etc... in a WIndows phone app?

4

2 回答 2

12

你忘了new

var map = new google.maps.Map(mapCanvas, mapOptions);
于 2013-10-09T14:41:01.300 回答
1

它不是该教程中代码的副本。您在 google.maps.Map 构造函数之前删除了“新”。

 var map = google.maps.Map(mapCanvas, mapOptions);

在教程中是:

 var map = new google.maps.Map(map_canvas, map_options);
于 2013-10-09T14:42:18.810 回答