Re: Why dosn't works with Data.xml
Pachew,
I see a couple of basic problems with your page. First, you are
executing your code in the head section, which will cause an error
because the page hasn't finished loading, which means the map div isn't
yet defined. You can easily fix that by coding the map script in a
function, then calling that function with the <body
onload="LoadMap();"> method. I suggest you leave the declaration of the
map variable outside the function (just code in var map ;) to make it
global too.
Another issue you're going to run into is that you are creating the
marker in the same function as the one you are reading the xml file
from. This won't work because of issues with variable scoping. In order
to fix this, you will need to use a "createmaker" (standard name, you
can call it anything) function (really a thing called a closure) to
create your markers.
Your xml file looks ok.
Be sure to have Javascript errors switched to show all (IE) or open
your Javascript console (FF and Mozilla) to see that you have no code
errors when you run the thing.
Check out Mike Williams tutorials for additional information:
http://www.econym.demon.co.uk/googlemaps/index.htm
Also the Mapki:
http://mapki.com
-John
http://maps.huge.info
0 Comments:
Yorum Gönder
<< Home