refresh a dynamic site
Hallo,
I am having a site, which gets the weather information of 4 cities via an XML Data. I have already done its XSLT via JavaScript it works fine but when I try to write a JavaScript refresh function I am getting an error like
document.getElementById(..)is nuill or not an object. So what should I do?
Here is my Javascript Code Chunk:
var xslProc;
var day = "1";
var wmo = "abcde";
function City(day1,wmo1){
this.day = day1;
this.wmo = wmo1;
xmlPath= "httpfoo.bar&WMO="+wmo1+"&foo.bar";
initWeather();
}
function Day(day1){
this.day = day1;
initWeather();
}
function loadXMLDoc(xmlDocURL) {
srcTree = new ActiveXObject("Msxml2.DOMDocument.3.0");
srcTree.async = false;
srcTree.load(xmlDocURL);
return srcTree;
}
function loadXSLDoc(xslDocURL) {
xsltTree = new ActiveXObject("Msxml2.XSLTemplate.3.0");
xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.3.0" );
xslDoc.async = false;
xslDoc.load(xslDocURL);
xsltTree.stylesheet = xslDoc;
return xslDoc;
}
function generateHTML(xmlTree,xslTree) {
xslProc = xsltTree.createProcessor();
xslProc.addParameter("day",day);
xslProc.addParameter("wmo", wmo);
xslProc.input = xmlTree;
xslProc.transform();
html = xslProc.output;
return html;
}
// PATH TO THE XML / XSL DOCs
var xmlPath= "http://foo.bar&WMO="+wmo+"&foo.bar";
var xslPath= "weather_city_day.xsl";
function initWeather() {
xmlTree = loadXMLDoc(xmlPath);
xslTree = loadXSLDoc(xslPath);
html = generateHTML(xmlTree, xslTree);
document.getElementById("epoWeather").innerHTML = html;
}
initWeather();
Your attitude determines your altitude
__________________
Your attitude determines your altitude
|