var xmlHttp;
var xmlDoc;
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
}
xmlHttp.open("GET","contact.xml",false);
xmlHttp.send(null);
xmlDoc=xmlHttp.responseXML;
var x=xmlDoc.getElementsByTagName("friend");
function show(i)
{
var fname=x[i].getElementsByTagName("fname")[0].childNodes[0].nodeValue;
var lname=x[i].getElementsByTagName("lname")[0].childNodes[0].nodeValue;
var phone=x[i].getElementsByTagName("phone")[0].childNodes[0].nodeValue;
var cell_phone=x[i].getElementsByTagName("cell_phone")[0].childNodes[0].nodeValue;
var fax=x[i].getElementsByTagName("fax")[0].childNodes[0].nodeValue;
var email=x[i].getElementsByTagName("email")[0].childNodes[0].nodeValue;
var txt="Last Name: "+lname+"
First Name: "+fname+"
Phone: "+phone+"
Cell Phone: "+cell_phone+"
Fax: "+fax+"
Email: "+email ;
document.getElementById("show").innerHTML=txt;
}