table and dom test
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
node_modules/
|
/node_modules
|
||||||
|
|||||||
38
index.html
38
index.html
@ -5,24 +5,30 @@
|
|||||||
<link rel="stylesheet" href ="style.css">
|
<link rel="stylesheet" href ="style.css">
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<meta name="viewport" content = "width=device.width, initial-scale=1.0"/>
|
<meta name="viewport" content = "width=device.width, initial-scale=1.0"/>
|
||||||
<script src="main.js"></script>
|
<script src="main.js" defer></script>
|
||||||
<title>javascript test</title>
|
<title>javascript test</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p class="center">webside test mit node backend</p>
|
<div class="head-col">
|
||||||
<button class="center" onclick="press()">Drück mich</button>
|
<p class="center">webside test mit node backend</p>
|
||||||
<button class="center" onclick="redBg()">hintergrund rot(dom)</button>
|
</div>
|
||||||
<table>
|
<button class="center" onclick="press()">Drück mich</button>
|
||||||
<tr>
|
<button class="center" onclick="redBg()">hintergrund rot(dom)</button>
|
||||||
<th scope="col">test1col</th>
|
<div class="adding">
|
||||||
<th scope="col">test2col</th>
|
<input id="inputText" type="text">
|
||||||
<th scope="col">test3col</th>
|
<button id="addButton">hinzufügen</button>
|
||||||
</tr>
|
</div>
|
||||||
<tr>
|
<div class="inputTable">
|
||||||
<th scope="row">testrow</th>
|
<table id="contentTable">
|
||||||
<td>7</td>
|
<thead>
|
||||||
<td>bla</td>
|
<tr>
|
||||||
</tr>
|
<th scope="col">id</th>
|
||||||
</table>
|
<th scope="col">text</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
21
main.js
21
main.js
@ -15,3 +15,24 @@ function redBg() {
|
|||||||
isRed = false;
|
isRed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const addButton = document.getElementById('addButton');
|
||||||
|
addButton.addEventListener('click', handleInput);
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
function handleInput() {
|
||||||
|
const inputText = document.getElementById('inputText').value;
|
||||||
|
/*alert(inputText);*/
|
||||||
|
const table = document.getElementById('contentTable');
|
||||||
|
const newRow = table.insertRow();
|
||||||
|
|
||||||
|
i++;
|
||||||
|
|
||||||
|
newRow.insertCell(0).textContent = i;
|
||||||
|
newRow.insertCell(1).textContent = inputText;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user