I inherited (not in the OO sense) a map of the world that uses the map and area tags to perform actions when regions of the map are moused over or clicked. It works fine in all the other browsers we've tested on (Chrome, Firefox, IE7); h开发者_运维知识库owever, IE8 (the primary browser we are supporting) does not function properly.
Some areas work exactly as they are supposed, but others do not respond at all.
To clarify, the map is mostly html (map and area tags) and images, with a little bit of JavaScript.
Here is a bit of sample markup:
<area shape="poly" id="A64" class="{linked:3,fillColor:'fff553'}" title="East Asia and the Pacific" href="#" onclick="return InitiateAsyncRequest('EastAsiaPacific');" coords="500,168,501,168,502,168,502,169,503,169,503,170,504,170,504,171,504,172,504,173,503,173,503,174,502,174,502,175,501,175,500,175,499,175,499,174,500,174,500,173,501,173,502,173,502,172,503,172,503,171,502,171,502,170,501,170,501,169,500,169" />
I am looking forward to replacing the map; however, for this release this is not an option. Thank you in advance for your help.
I was just having a mysterious problem with IE not using <map>
when everything else was fine. The solution for me was to ensure that I put a # in the usemap='#A64'
in the <img>
attributes
I've had the same problems in IE8. In my case, the solutions was to place all the coordinates on one line. When the coordinates where separated over multiple lines, all the browsers used the map correctly, except for IE8. After reformatting the file so that all coordinated were on the same row, the map was shown correct in IE8 as well.
From the description, I'd say it sounds like the <map>
/ <area>
tags are a red herring here. If some of them are working, then there's no obvious reason why others shouldn't do.
What I think is more likely to be the problem is a bug in your Javascript code. In this scenario, some of your links would work and others wouldn't because they hit a certain bit of JS that is broken.
IE is often a bit more picky about Javascript errors than Firefox or Chrome (and at the same time it is less helpful with its error reporting!), so this seems like an obvious route of enquiry.
Try changing the JS on the broken ones so they are the same as one of the ones that works. Does the broken one work now (albeit acting as the wrong map location)? If that works, then there's nothing wrong with your <area>
tags; it must be in the Javascript.
If IE isn't reporting the JS error, then you're going to have to find the bug the hard way, by debugging your way through the code one line at a time until you find where it's breaking.
Since you're using IE8, you have the developer tools available, so make sure that's open, and add console.log()
calls before every line of your code. Run the code and see where the console.log()
messages stop.
Hope that helps.
(Having said that all that, have you tried reducing the number of points in the polygon? Maybe IE has a limit? I doubt it, but it's worth trying if nothing else works)
精彩评论