Вход на сайт
Кто побежит на работу если ему деньги не нужны?
5198 просмотров
Перейти к просмотру всей ветки
в ответ Trollinger 27.09.24 06:17
Да всёравно, пример работает, а Ajax уже устарел. Вот по старому:
var tm = null; function refresh(url, cb) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if(xhttp.readyState == 4 && xhttp.status == 200) { cb(xhttp.responseText); }}; xhttp.open("GET", url, true); xhttp.send(); } window.onload = function(event) { tm = setInterval(function() { refresh('da.txt', function(v) { document.getElementById('da').setAttribute('style', 'width:' + v + '%;');}); refresh('net.txt', function(v) { document.getElementById('net').setAttribute('style', 'width:' + v + '%;');});}, 1000); }
Если я кому-то отвечаю, это не значит что я ему симпатизирую, каждый остаётся при своём мнение