12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- //multiply table если поменять обявление колонок то можно будит подсвечивать сразу все ячейки колонки
- /* let boddy = document.querySelector('body');
- let table = document.createElement('table')
- let tbody = document.createElement('tbody')
- for(let rowIndex = 1; rowIndex<10; rowIndex++){
- let rows = document.createElement('tr');
- for(let cellIndex = 1; cellIndex<10; cellIndex++){
- let cell = document.createElement('td');
- let cellText = document.createTextNode(rowIndex*cellIndex);
- cell.appendChild(cellText);
- rows.appendChild(cell);
- cell.onmouseover = function(event) {
- event.target.style.background = "silver";
- }
- cell.onmouseleave = function(event) {
- event.target.style.background = "";
- }
-
- }
- tbody.appendChild(rows);
- rows.addEventListener("mouseover", function hoverOnRow(){
- this.style.backgroundColor="green";
- });
- rows.addEventListener("mouseleave", function hoverOnRowEnd(){
- this.style.backgroundColor="";
- });
- }
- table.appendChild(tbody);
- boddy.appendChild(table);
- */
- /* let sumBtn = document.getElementById('calc'); */
- /* function sumNumbers(a,b) {
- return a+b;
- } */
- /* sumBtn.addEventListener('click', function sumNumbers(){
- let firstNumber = +(document.getElementById('firstNumber').value);
- let secondNumber = +(document.getElementById('secondNumber').value);
- return console.log(firstNumber+secondNumber);
- }) */
- /* document.getElementById('firstNumber').addEventListener('change',calc,false);
- document.getElementById('secondNumber').addEventListener('change',calc,false);
- function calc() {
- let firstNumber = +(document.getElementById('firstNumber').value);
- let secondNumber = +(document.getElementById('secondNumber').value);
- document.getElementById('result').value = firstNumber + secondNumber;
-
- }
- calc(); */
- let input1 = document.getElementById('firstNumber');
- let input2 = document.getElementById('secondNumber');
- function calc() {
- let result = document.getElementById('result');
- result.value = (+input1.value) + (+input2.value)
- }
- input1.oninput = calc;
- input2.oninput = calc;
- /* sumNumbers(firstNumber,secondNumber); */
|