codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  reading xml embedded in HTML with JavaScript.  deluxmilkman at 08:50 on Tuesday, March 24, 2009
 


I`m trying to write XML in HTML and read it with JavaScript,
but it`s not working.
please help.

my XML in HTML.
[CODE]
<xml id="xmldata" style='display:none;'>
<markers>
<marker lat="50.895842" lng="-1.4051" html="text"/>
</markers>
</xml>
[/CODE]

Javascript trying to read my XML.
[CODE]

document.getElementById('xmldata');
if(xml.documentElement == null)
xml.documentElement = xml.firstChild;

var markers = xmlDoc.documentElement.getElementsByTagName("marker");

for (var i = 0; i < markers.length; i++) {
// obtain the attribues of each marker
var lat = parseFloat(markers.getAttribute("lat"));
var lng = parseFloat(markers.getAttribute("lng"));
var point = new GLatLng(lat,lng);
var html = markers.getAttribute("html");


// create the marker
var marker = createMarker(point,label,html);
map.addOverlay(marker);
}
[/CODE]









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Need Menu Control that can come from side also...
•  Command and control application using Sphinx 4
•  Re: Print and print preview file on the website without using the File - Print on the IE
•  Table dynamique (datafld and title)
•  reading xml embedded in HTML with JavaScript.
•  how to convert wav file to text file
•  html code running php function
•  Re: NEWBIE in need of help.
•  Converting a Long to Date time


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009