-
April 5th, 2009, 01:06 PM
#1
i need some help fast
hi, i am making an auto content update system with javascript i have it written, but am having problems with safari loading my xml doc
thanks for help in advance
here is my code:
Code:
function displayFullEvents()
{
var currentDate = new Date();
var cuMo = currentDate.getMonth()+1;
var cuDa = currentDate.getDate();
var cuYe = currentDate.getYear();
var req;
var output = "";
var url = "events.xml";
var xmlDoc=null;
if (document.implementation.createDocument)
{// code for Mozilla, Firefox, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
}
else if (window.ActiveXObject)
{// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else
{
alert('Your browser cannot handle this script');
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("events.xml");
var x=xmlDoc.getElementsByTagName("EVENT");
var y=xmlDoc.getElementsByTagName("MONTH");
var r=xmlDoc.getElementsByTagName("year");
output += "<table cellpadding=3 cellspacing=2>";
for (j=0;j<y.length;j++){
var t=y[j].getElementsByTagName("EVENT");
var month = y[j].getElementsByTagName("number")[0].childNodes[0].nodeValue;
if((cuMo <= month)){
output += "<tr><td colspan=2><b><u>";
output += y[j].getElementsByTagName("idthing")[0].childNodes[0].nodeValue;
output += "</u></b></tr></td>";
for (i=0;i<t.length;i++)
{
var day = t[i].getElementsByTagName("daynum")[0].childNodes[0].nodeValue;
if ((cuMo == month) && (cuDa <= day)){
output += "<tr>";
output += "<td valign='top'>";
output += t[i].getElementsByTagName("DATE")[0].childNodes[0].nodeValue;
output += "</td>";
output += "<td>";
output += t[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue;
output += "</td>";
output += "</tr><tr><td></td></tr>";
}
else if ((cuMo < month)){
output += "<tr>";
output += "<td valign='top'>";
output += t[i].getElementsByTagName("DATE")[0].childNodes[0].nodeValue;
output += "</td>";
output += "<td>";
output += t[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue;
output += "</td>";
output += "</tr><tr><td></td></tr>";
}
}
output += "<tr align='center'> <TD align='center' colspan='2'><a href='tester.html' class='month'>TOP</a></TD></TR>";
}
}
output += "</table>";
}
test = document.getElementById('div1');
test.innerHTML=output;
}
-
April 5th, 2009, 07:45 PM
#2
Re: i need some help fast
For Safari, you need to be using AJAX (XMLHttpRequest).
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|