Google Map api v3 - IE7 - main.js error - invalid

2019-07-07 02:54发布

问题:

http://bit.ly/xkHPnU

I've looked at all of the timing issues, and I can't seem to resolve this error. Occurs in IE7 and compatibility modes as a warn-on error.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0)
Timestamp: Fri, 2 Mar 2012 21:58:06 UTC


Message: Invalid argument.
Line: 27
Char: 56
Code: 0
URI: http://maps.gstatic.com/intl/en_us/mapfiles/api-3/7/12/main.js

Need another set of eyes on it.

Thanks.

回答1:

The problem appears at line 27, here: e.minWidth=W(d). The result of W(d) is equal to '-12px' and IE does not want to set negative value to the minWidth attribute.

Debugging further I can see that this code is related to the rendering of the map controls. Moreover, the problem have place only for the switch-button between Map/Satellite views (value of c variable is "roadmap"). Also it looks like the code is executed by triggered onchange event, which might be connected to the tabs over the map. As a test I removed those tabs with a simple rule in Proxomitron and that error did not appear any more.

So, try to place those tabs in such location or way (for example with position for the parent div set to relative and the parent of tabs with absolute position and negative value of the top css attribute) that the part under them will not change size during their initialization (tabs script applied to them) or initialize your google map after their rendering (set some delay).



回答2:

setting like this

mapTypeControl:true, 
mapTypeControlOptions: { 
    style: window.google.maps.MapTypeControlStyle.DROPDOWN_MENU 
} 

will solve the problem.



回答3:

this problem is not resolved with the given solution.

I am using two google map and using the same jquery-1.4.1.min.js file. But when i ma running individual then it is running. But when using two map. then e.minWidth=x(D) coming with -12px values as the same stackoverflow problem . So please provide me the solution.



回答4:

I have same problem in IE8. when map is open and open debug mode in IE popup Invalid Argument will be appear

I solved by add "mapTypeControl" and "mapTypeControlOptions" like answer of user2884829

var map = new google.maps.Map(document.getElementById('map_canvas'), {
    zoom: 19,
    center: latLng,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: true,
    mapTypeControlOptions: {
         style: window.google.maps.MapTypeControlStyle.DROPDOWN_MENU
    }
});