Yahoo Maps API - Firefox中的代码相同,而不是IE7

时间:2010-08-23 13:02:28

标签: asp.net

我使用JQUERY实现了一个简单的yahoo映射示例。

我的问题是我正在使用我的localhost开发,我的目标平台是在Intranet环境中。我的想法是我的localhost将在某种程度上模仿这个。

我有更新,取得了一些进展。请参阅下面的代码片段,所有在Firefox中都可以,但在IE(我的目标浏览器)中,它就失败了:

var currentGeoPoint = new YGeoPoint($('#txtLatitude')。val(),$('#txtLongitude')。val());

我无法理解的是IE为什么允许MAP API代码运行和操作MAP对象并在这一行上失败。

这可能与工具/内联网选项/安全性和可信站点等有关吗?如果有任何帮助,我的本地网址为“http://localhost:4724/LMS/Site.mvc/Details/77”。

    $(document).ready(function() {

        jQuery("textarea[class*=expand]").TextAreaExpander(); // initialize all expanding textareas, new code, john s 10/08/2010

        var geoPoint;
        // Create a map object
        var map = new YMap(document.getElementById('map'));

        // Add map type control  
        map.addTypeControl();

        // Set map type to either of: YAHOO_MAP_SAT, YAHOO_MAP_HYB, YAHOO_MAP_REG  
        map.setMapType(YAHOO_MAP_REG);

        // Display the map centered on a geocoded location
        map.drawZoomAndCenter("United Kingdom", 12);

        // Add map type control  
        map.addTypeControl();

        // Add map zoom (long) control  
        map.addZoomLong();

        // Add the Pan Control
        map.addPanControl();

        // Set map type to either of: YAHOO_MAP_SAT, YAHOO_MAP_HYB, YAHOO_MAP_REG  
        map.setMapType(YAHOO_MAP_REG);

        // Display the map centered on a geocoded location
        map.drawZoomAndCenter("United Kingdom", 12);

        var currentGeoPoint = new YGeoPoint($('#txtLatitude').val(), $('#txtLongitude').val()); // FAILS IN IE ON THIS LINE!! Unspecified Error popup dialogue box
        map.addMarker(currentGeoPoint);


    });

约翰

1 个答案:

答案 0 :(得分:0)

让它现在正常工作,恢复原来的javascript,我手动滚动我自己的代码,虽然neater不在IE中工作。很高兴能走出困境,欢呼,J