In the map space search, the results of the data returned with Ajax, in addition to the punctuation on the map need to be listed in the traditional form, and can click to view information, because the need for the return of the results of the processing is flexible enough, so can not write dead in JS format. Here the way to use the XML data island (the system is only to consider IE) only to use the XML data information returned, how to layout on the HTML page can be customized by other developers themselves.
The following code removes the Ajax section and simply demonstrates how to generate an XML data island and how to bind to HTML tables and display related link information. The href content of the link can be saved in the XML data and processed with the datafld attribute.
<title>xml Data Island </title>
<script type= "Text/jscript" ....
Get XML, most of the actual applications are AJAX-acquired asynchronously
function GetData ()
... {
var xmldata= "<xml id=" XmlData "><root>";
for (Var i=0;i<5;i++)
... {
Try
... {
var id= "Name" +i;
var type= "Type" +i;
xmldata+= "<METADATA><Name>" +id+ "</Name>;<type>" +type+ "</Type><Href> Javascript:aler t (' "+id+") </Href></METADATA> ";
pointindex++;
}
catch (E)
... {
}
}
xmldata+= "</root></xml>";
Document.all.xmldatapanel.innerhtml=xmldata;
}
Simple Add XML information
function AddData ()
... {
var xmldata= document.all.xmlDataPanel.innerHTML;
Xmldata=xmldata.replace ("</root></xml>", "");
xmldata+= "<metadata><name>newname</name><type >newType</Type><Href> Javascript:alert (' newName ') </Href></METADATA>;
xmldata+= "</root></xml>";
Document.all.xmldatapanel.innerhtml=xmldata;
}
</script>
<body>
<button onclick= "Javascript:getdata ();" > Get Data </button>
<button onclick= "Javascript:adddata ();" > Add Data </button>
<div id= "Xmldatapanel" >
</div>
<div style= "Overflow:scroll; height:180;width:180 "align=" Center ">
<div align= "Left" >
<!--bindings, hyperlinks where the datafld attribute, the value of href can also be saved in the XML data island, more flexible, you can make a JS function or a URL address-->
<table datasrc= "#xmlData" border= "1" >
<tr>
<td>
<a datafld= "Href" ><span datafld= "Name" ></span></a>
</td>
<td>
<span datafld= "Type" ></span>
</td>
</tr>
</table>
</div>
</div>
</body>