View Single Post
  #1 (permalink)  
Old November 10th, 2010, 06:33 AM
phuchoang2583 phuchoang2583 is offline
Authorized User
Join Date: Oct 2010
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Default Loading XML file

Hello everybody
I have taken more hours to do this
but it is not work, i want to try to get ID from datbase
This is my code

function createMarker(point, index, html)
// var letter = String.fromCharCode("A".charCodeAt(0) + index);
var letteredIcon = new GIcon(icon0);
var geticon=new GIcon(baseIcon);
var ID= <%=GetHotelID %>; // get ID from database
var locations = xmlDoc.documentElement.getElementsByTagName("locat ion");
var m;
var hotelids = xmlDoc.getElementsByTagName("hotelid");
var hnames = xmlDoc.getElementsByTagName("hname");
for (m=0;m<locations.length;m=m+1)

var hotelid = parseInt(hotelids[m].firstChild.nodeValue);
var hotelname = hnames[m].firstChild.nodeValue;
alert(hotelid +'=' + ID ) ;
if (hotelid=ID) //compare hotelid with ID to appeare
var marker = new GMarker(point, letteredIcon);
var marker = new GMarker(point, geticon);
GEvent.addListener(marker, "mouseover", function()
{ marker.openInfoWindowHtml(html); }
markerList[index] = {marker:marker, html:html};
return marker;

XML File

<MapName>Novotel Hotel Nha Trang</MapName>
<hname>novotel Nha trang</hname>
<provincename>Nha Trang</provincename>

<hname>Yasaka Saigon Nha Trang</hname>
<provincename>Nha Trang</provincename>

<MapName>Sunrise Hotel</MapName>
<hname>Sunrise Hotel</hname>
<provincename>Nha Trang</provincename>

<MapName>Diamond Bay Resort</MapName>
<hname>Diamond Bay Resort and Golf</hname>
<provincename>Nha Trang</provincename>
Thanks in advance