自动更新 XML 文件,没有要显示的条目和错误。
XML文件;
<programme channel="cnn.info" start="20131021000000" stop="20131021010000">
<title>CNN Newsroom live from Hong Kong</title>
<premiere/></programme>
<programme channel="cnn.info" start="20131021010000" stop="20131021020000">
<title>CNN Newsroom live from Hong Kong</title>
<premiere/></programme>
<programme channel="cnn.info" start="20131021020000" stop="20131021023000">
<title>BackStory</title>
Javascript代码;
<![CDATA[
var autoUpdate, xmlData, loadXMLData, update, eventsXML;
update = function() {
if ( xmlData.readyState == 4 ) {
if ( xmlData.status == 200 ) {
programme = xmlData.responseXML.getElementsByTagName("programme");
for ( var programme in programme ) {
alert(programme + ": All data has been updated!");
// and the rest of the code continue -->
}
}
}
}
loadXMLData = function( url ) {
xmlData = null;
if ( window.XMLHttpRequest ) {
xmlData = new XMLHttpRequest();
}
else if ( window.ActiveXObject ) {
try {
xmlData = new ActiveXObject("Microsoft.XMLHTTP");
}
catch( e ) {
xmlData = new ActiveXObject("Msxml2.XMLHTTP");
}
}
if ( xmlData !== null ) {
xmlData.onreadystatechange = update;
xmlData.open("GET", url, true);
xmlData.send( null );
}
else {
alert("\nYour browser does not support AJAX Request!");
}
};
window.onload = function() { autoUpdate = setInterval('loadXMLData("EXAMPLE_XML_FILE.xml")', 10000);
};
]]>
目标
我想每 1 分钟刷新一次 XML 文件,但是这个过程将是自动化的,并且没有刷新页面加载
结果
为什么不起作用..没有错误,只有;白色错误
PS.:我没有任何html代码