I am looking for a little help… I have an xml document that I am loading into a page and for some reason it is not displaying in Safari. Below is the javascript used to load the xml. I am far from an expert developer so I hoping that someone may have run into a similar problem. I am not opposed to using php instead just as long as I can get it to load in IE, Firefox, and Safari.
<---- code below —>
<script type=“text/javascript”>
var xmlDoc
var i
function querystring(name) // returns a named value from the querystring
{
var tmp = unescape( location.search.substring(1) );
var i = tmp.toUpperCase().indexOf(name.toUpperCase()+"=");
if ( i >= 0 )
{
tmp = tmp.substring( name.length+i+1 );
i = tmp.indexOf("&");
return( tmp = tmp.substring( 0, (i>=0) ? i : tmp.length ));
}
return("");
}
function loadXML()
{
i = querystring("id");
//load xml file
xmlDoc = false;
// branch for native XMLHttpRequest object
if(window.XMLHttpRequest) {
try {
xmlDoc = new XMLHttpRequest();
xmlDoc.setRequestHeader('If-Modified-Since', 'Wed, 15 Nov 1995 00:00:00 GMT');
}
catch(e) {
xmlDoc = false;
}
}
// code for IE
if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load("note.xml");
getmessage();
}
// code for Mozilla, etc.
else if (window.XMLHttpRequest)
{
xmlDoc = new XMLHttpRequest();
xmlDoc = document.implementation.createDocument("","",null);
xmlDoc.load("note.xml");
xmlDoc.onload=getmessage;
}
else
{
alert('This browser does not support the XML data in this document. It is best viewed in IE 5.0+ or Firefox');
}
}
function getmessage()
{
document.getElementById("title").innerHTML=
xmlDoc.getElementsByTagName("title")*.firstChild.nodeValue
document.getElementById("plate").src=
xmlDoc.getElementsByTagName("plate")*.firstChild.nodeValue
document.getElementById("img").src=
xmlDoc.getElementsByTagName("img")*.firstChild.nodeValue
document.getElementById("summary").innerHTML=
xmlDoc.getElementsByTagName("summary")*.firstChild.nodeValue
}
</script>