var weatherRss var i=0; function getWeather(str) { weatherRss=GetXmlHttpObject() if (weatherRss==null) { alert ("Browser does not support HTTP Request") return } var url="weather2.php" url=url+"?city="+str url=url+"&sid="+Math.random() weatherRss.onreadystatechange=weatherCheck weatherRss.open("GET",url,true) weatherRss.send(null) } function weatherCheck() { if (weatherRss.readyState==4 || weatherRss.readyState=="complete") { //s = new String(xmlHttp.responseText); mystring = replace(weatherRss.responseText,'

','
'); document.getElementById('activeContent').innerHTML = mystring; } } ///////////////////////////////////////////////////////// // TIMER ///////////////////////////////////////////////////////// function start() { if(i<=10) { getWeather(i); i++; } else { i=0; getWeather(i); } setTimeout('start()',10000); } ////////////////////////////////// // THIS IS A STRING REPLACE FOR IE ////////////////////////////////// function replace(string,text,by) { // Replaces text with by in string var strLength = string.length, txtLength = text.length; if ((strLength == 0) || (txtLength == 0)) return string; var i = string.indexOf(text); if ((!i) && (text != string.substring(0,txtLength))) return string; if (i == -1) return string; var newstr = string.substring(0,i) + by; if (i+txtLength < strLength) newstr += replace(string.substring(i+txtLength,strLength),text,by); return newstr; } /////////////////////////////////// window.onload = start;