Public feed #724808

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-10-03 22:03 UTC
rendered paste body
function edit(t) {
	var td = t.getElementsByTagName("td");
	var id = td[0].firstChild.nodeValue;
	var what = td[1].firstChild.nodeValue;
	var tags = td[2].firstChild.nodeValue;
	var imp = td[4].firstChild.nodeValue;
	
	td[0].innerHTML = '<input type="text" value="'+id+'" class="input" />';
	td[1].innerHTML = '<input type="text" value="'+what+'" class="input" />';
	td[2].innerHTML = '<input type="text" value="'+tags+'" class="input" />';
	td[4] = makeImportance(imp);
	
	alert("Editing "+id+" with contents of \""+what+"\"");
}

function makeImportance(val) {
	var imp = new Array(1, 2, 3, 4, 5, 6);
	
	var sel = document.createElement('select');
	sel.class = "sel";
	
	for(k in imp) {
		var opt = document.createElement('option');
		opt.appendChild( document.createTextNode(imp[k]) );
		
		if (imp[k] == val)
			opt.selected = "selected";
			
		sel.appendChild( opt );
	}
	
	return sel;
}