diff --git a/js/include.js b/js/include.js new file mode 100644 index 00000000..648b7dff --- /dev/null +++ b/js/include.js @@ -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); \ No newline at end of file