Skip to content

Commit b657461

Browse files
author
VentGrey
committed
Mejoras al JS de la navbar
1 parent 4d1ddf9 commit b657461

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

navbar.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
function includeHTML() {
2-
var z, i, elmnt, file, xhttp;
3-
z = document.getElementsByTagName("*");
4-
for (i = 0; i < z.length; i++)
5-
{
6-
elmnt = z[i];
7-
file = elmnt.getAttribute("inc");
8-
if (file)
9-
{
10-
xhttp = new XMLHttpRequest();
11-
xhttp.onreadystatechange = function()
12-
{
13-
if (this.readyState == 4)
14-
{
15-
if (this.status == 200) {elmnt.innerHTML = this.responseText;}
2+
const z = document.getElementsByTagName("*");
3+
for (let i = 0; i < z.length; i++) {
4+
const elmnt = z[i];
5+
const file = elmnt.getAttribute("inc");
6+
if (file) {
7+
const xhttp = new XMLHttpRequest();
8+
xhttp.onreadystatechange = function() {
9+
if (this.readyState == 4) {
10+
if (this.status == 200) { elmnt.innerHTML = this.responseText; }
1611
elmnt.removeAttribute("inc");
1712
}}
1813
xhttp.open("GET", file, true);
1914
xhttp.send();
2015
return;
21-
}}};
16+
}
17+
}
18+
};

0 commit comments

Comments
 (0)