//es6 let afooter = document.querySelector("#afooter"), bfooter = document.querySelector("#bfooter"), calculeit = document.querySelector("#calculeit"), output = document.querySelector("#output"); calculeit.addEventListener("click", function(){ calc }); function calc() { output.value = ((+afooter.value) + (+bfooter.value)); }; afooter.oninput = calc; bfooter.oninput = calc; let table = document.createElement("table"), src = document.querySelector("script"), td = document.getElementsByTagName("td"), tr = document.getElementsByTagName("tr"); document.body.insertBefore(table, src); let namb = ""; for (let i = 0; i < 10; i++){ namb += "" for (let j = 0; j < 10; j++){ if (i == 0){namb += "" + j + "";} else {namb += "" + i * (j === 0 ? 1 : j) + "";} } namb += "" } table.innerHTML = namb for (let i = 0; i < 100; i++) { td[i].addEventListener("mouseover", function(){ for (let x = 0; x < 10; x++){td[i].parentElement.children[x].style.backgroundColor = "#98f9d2";} for (let y = 0; y < 100; y++){if (td[i].cellIndex === td[y].cellIndex) {td[y].style.backgroundColor = "#98f9d2" }; }; }); td[i].addEventListener("mouseout", function(){ for (let x = 0; x < 10; x++) {td[i].parentElement.children[x].style.backgroundColor = "#b3fcde";}; for (let y = 0; y < 100; y++) { if (td[i].cellIndex === td[y].cellIndex) {td[y].style.backgroundColor = "#b3fcde";}; }; }); }; //sort let suv = [ {manufacturer:"Land Rover", model:"Range Rover Sport SVR", horsePower:575}, {manufacturer:"BMW", model:"X5M", horsePower:555}, {manufacturer:"Jeep", model:"grand cherokee trackhawk", horsePower:717}, {manufacturer:"lamborghini", model:"Urus", horsePower:650}, {manufacturer:"MERCEDES-BENZ", model:"GLE 63 S AMG", horsePower:558}, {manufacturer:"Audi", model:"RS Q3", horsePower:310}, {manufacturer:"Tesla", model:"Model X", horsePower:773}, ] function sortSuv (d,b,c){ if(b==="horsePower"){suv.sort(function(a,b){return a.horsePower - b.horsePower}) }; if(b==="manufacturer"){ if(c===true){ suv.sort(function(a,b){ if(a.manufacturer>b.manufacturer){return 1} if(a.manufacturer