WEB/Praktikum2/ppm1/static/functions.js
darthsandmann 9e8ac3d880 JS, Edit
2016-11-07 17:59:41 +01:00

23 lines
577 B
JavaScript

var table = document.getElementById('idList');
var selected = table.getElementsByClassName('selected');
var selectedId = 'None';
table.onclick = highlight;
function select(category) {
var id = selectedId;
if (id == 'None')
{
alert("Kein Eintrag ausgewaehlt!");
}
else
{
window.location.href = '/detail/?cat=' + category + '&id=' + id;
}
}
function highlight(e) {
if (selected[0]) selected[0].className = '';
e.target.parentNode.className = 'selected';
var tr = e.target.parentNode;
selectedId = tr.getAttribute('id');
}