Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronkir committed Mar 9, 2020
1 parent 42d7e3c commit e9bd346
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
1 change: 1 addition & 0 deletions 01_plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions 02_minus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions 03_edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions 04_expand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions 05_save.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<html>

<head>
<meta charset="utf-8">
<title>JavaScript: Hallo Welt</title>
<style>
table,
th,
td {
border: 1px solid black;
}
</style>
</head>

<body>
<h1>Property Editor</h1>
<div>
Press + to start entering key/value pairs.
</div>
<div id="actions">
<button id="add_row"><img src="01_plus.svg" width="20" /></button>
<button id="resolve"><img src="04_expand.svg" width="20" /></button>
</div>
<div>
<table id="prop">
<tr>
<th>Key</th>
<th>Value</th>
<th>Resolved Value</th>
<th colspan=3>Actions</th>
</tr>
</table>
</div>
</body>
<script>
var addRowButton = document.getElementById('add_row');
addRowButton.addEventListener('click', addRow, true);

function addRow() {
// Find a <table> element with id="myTable":
var table = document.getElementById("prop");

// Create an empty <tr> element and add it to the 1st position of the table:
var numLines = table.rows.length;
var row = table.insertRow(numLines);

// Insert new cells (<td> elements) at the 1st and 2nd position of the "new" <tr> element:
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
var cell4 = row.insertCell(3);

// Add some text to the new cells:
cell1.innerHTML = '<input type="text" id="key">';
cell2.innerHTML = '<input type="text" id="value">';
cell3.innerHTML = 'value';
cell4.innerHTML = '<button id="' + numLines + '" onClick="save(this.id)"><img src="05_save.svg" width="20" /></button>'
+'<button id="' + numLines + '" onClick="editRow(this.id)"><img src="03_edit.svg" width="20" /></button>'
+'<button id="' + numLines + '" onClick="deleteRow(this.id)"><img src="02_minus.svg" width="20" /></button>'
}

function deleteRow(lineNumber) {
var table = document.getElementById("prop");
table.deleteRow(lineNumber);
}

function editRow(lineNumber) {
var table = document.getElementById("prop");
alert(lineNumber);
}
function save(lineNumber) {
var table = document.getElementById("prop");

}
</script>
<noscript>
Sie haben JavaScript deaktiviert.
</noscript>

</html>

0 comments on commit e9bd346

Please sign in to comment.