mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-14 02:38:12 +02:00
First version.
This commit is contained in:
1 parent
bcf3a3b4ef
commit
e083ead16b
8 files changed
+292
No files matched your search
@@ -0,0 +1,26 @@
|
||||
function includeHTML() {
|
||||
var z, i, elmnt, file, xhttp;
|
||||
|
||||
console.log("Including HTML.")
|
||||
|
||||
z = document.getElementsByTagName("*");
|
||||
for (i = 0; i < z.length; i++) {
|
||||
elmnt = z[i];
|
||||
|
||||
file = elmnt.getAttribute("include");
|
||||
if (file) {
|
||||
xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4) {
|
||||
if (this.status == 200) {elmnt.innerHTML = this.responseText;}
|
||||
if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
|
||||
elmnt.removeAttribute("include");
|
||||
includeHTML();
|
||||
}
|
||||
}
|
||||
xhttp.open("GET", file, true);
|
||||
xhttp.send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user