반응형
<div data-include-path="include/html/inc_left.html"></div>
window.addEventListener('load', function() {
var allElements = document.getElementsByTagName('*');
Array.prototype.forEach.call(allElements, function(el) {
var includePath = el.dataset.includePath;
if (includePath) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
el.outerHTML = this.responseText;
}
};
xhttp.open('GET', includePath, true);
xhttp.send();
}
});
});
728x90
반응형
'web > javascript & jquery' 카테고리의 다른 글
drag floating menu (0) | 2021.10.12 |
---|---|
video player (0) | 2021.10.12 |
[javascript & jQuery] 레이어 팝업 항상 정 가운데로 정렬(펌) (0) | 2021.03.22 |
default parameter value 파라메터 기본값 (0) | 2021.03.22 |
[펌]글자 타이핑 효과 (0) | 2020.08.26 |