<script type="text/javascript">
function load(url, container) {
var xhr = typeof XMLHttpRequest == "undefined" ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest;
xhr.open("GET", url, true);
xhr.send(null);
container.innerHTML = ' <img src="http://javascript.ru/forum/images/ca_serenity/misc/progress.gif" alt="loading…" /> ';
(function () {
if (xhr.readyState == 4) {
if(xhr.status == 200) {
container.innerHTML = xhr.responseText;
}
else {
container.innerHTML = "Error: returned status code " + xhr.status + " " + xhr.statusText;
}
}
else {
setTimeout(arguments.callee, 20);
}
}());
}
function doIt() {
load("http://javascript.ru/forum/clientscript/vbulletin_editor.css?p=" + Math.random(), document.getElementById("work1"));
load("http://javascript.ru/modules/codeviewer/codeviewer.css?p=" + Math.random(), document.getElementById("work2"));
load("http://javascript.ru/forum/images/ca_serenity/misc/scripts.js?p=" + Math.random(), document.getElementById("work3"));
}
</script>
<div id="work1" style="background: #fcc;">1</div>
<div id="work2" style="background: #cfc;">2</div>
<div id="work3" style="background: #ccf;">3</div>
<button onclick="doIt()">Загрузить</button>