parent
bc4d9c0a30
commit
acf54ae5e7
@ -0,0 +1,19 @@
|
||||
function includeHTML() {
|
||||
var elements = document.getElementsByTagName("include");
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
var element = elements[i];
|
||||
var file = element.getAttribute("src");
|
||||
if (file) {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
element.innerHTML = this.responseText;
|
||||
}
|
||||
};
|
||||
xhttp.open("GET", file, true);
|
||||
xhttp.send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", includeHTML);
|
Loading…
Reference in new issue