首页 > asp.net > Yahoo Maps API - Firefox中的代码相同,而不是IE7

Yahoo Maps API - Firefox中的代码相同,而不是IE7 (Yahoo Maps API - Same code ok in Firefox, not IE7)

2010-08-23 asp.net

问题

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

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

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

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

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

这可能与工具/内联网选项/安全和可信站点等有关吗?我的URL本地是“ 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);


    });

约翰

解决方法

现在有这个工作,恢复原来的javascript,我手动我自己的代码,虽然neater没有在IE中工作。很高兴能走出困境,欢呼,J

问题

I've implemented a simple yahoo mapping example using JQUERY.

My problem is i'm developing using my localhost, my intended target platform is to be within an Intranet environment. My thinking is that my localhost will to some extent mimic this.

I have an update, made some progress. See the code snippet below, all ok in Firefox but in IE (my target browser) it fails on the line:

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

What I cannot understand is why will IE allow the MAP API Code to run and manipulate the MAP object and fail on this one line.

Could this all be to do with Tools/Intranet Options/Security and trusted sites etc? My URL locally is "http://localhost:4724/LMS/Site.mvc/Details/77" if thats any help.

    $(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);


    });

John

解决方法

Have this working now, reverted back to original javascript, i'd hand rolled my own code and although neater was not working in IE. Glad to be out of the woods, cheers, J

相似信息