Aleksandr N
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Mavrikii Вот это точно работает, о чём я и говорил. Нужно что-то подобное сделать. Код: function AutomaticallySearchCity() { var locationip = "http://www.geoplugin.net/json.gp"; var tmp = new ActiveXObject("Microsoft.XMLHTTP"); tmp.open("GET", locationip, true); tmp.onreadystatechange=function() { if (tmp.readyState==4) { if (tmp.Status == 200) { var geoipdata = tmp.responseText; geoipdata = geoipdata.split('",'); var citybyip = geoipdata[2]; citybyip = citybyip.substring(citybyip.indexOf('"geoplugin_city":"') + 18, citybyip.length); var countrybyip = geoipdata[7]; countrybyip = countrybyip.substring(countrybyip.indexOf('"geoplugin_countryName":"') + 25, countrybyip.length); if (citybyip && countrybyip) { if (GetSourceOfUpdates.value == "weatherchannel") WeatherChannelSearchCityCode(citybyip + ", " + countrybyip); if (GetSourceOfUpdates.value == "accuweather") AccuSearchCityCode(citybyip + ", " + countrybyip); if (GetSourceOfUpdates.value == "wunderground") WUndergroundSearchCityCode(citybyip); if (GetSourceOfUpdates.value == "msn") MSNSearchCityCode(citybyip + ", " + countrybyip); if (GetSourceOfUpdates.value == "weathereye") WeatherEyeSearchCityCode(citybyip); if (GetSourceOfUpdates.value == "weatherbug") WeatherBugSearchCityCode(citybyip + ", " + countrybyip); } var locationip = "http://export.yandex.ru/bar/reginfo.xml?rnd=" + Math.random(); var geoipdata = loadXmlDoc(locationip); var citybyip = geoipdata.getElementsByTagName('title')[0].firstChild.nodeValue; if (citybyip) { if (GetSourceOfUpdates.value == "yandex") YandexSearchCityCode(citybyip); if (GetSourceOfUpdates.value == "gismeteo") GismeteoSearchCityCode(citybyip); if (GetSourceOfUpdates.value == "meteonova") MeteonovaSearchCityCode(citybyip); } } } } tmp.Send(null); } | Как пример привёл. Можно как-то сделать. Добавлено: Вот не смогу сам сделать, лучше готовым кодом в указанную функцию. |