Hi all,

I have a jsp page. It display a table contain 3 columns. 1st column display color name, 2nd for purpose of color like that..
Now i need the contents in td element to editable.
This is the sample code. here status is a vector table.

out.println("<td align=left class=formlabel1 bordercolor=white >"+status.get(1)+"</td>");

suggest me.
Thanks in advance..

<table border="1">
<tr><td class="editable">text1</td><td>text2</td><td><input type="checkbox" onclick="edit_input(this);">Edit</td></tr>
<tr><td>text3</td><td class="editable">text4</td><td><input type="checkbox" onclick="edit_input(this);">Edit</td></tr>
<tr><td class="editable">text5</td><td>text6</td><td><input type="checkbox" onclick="edit_input(this);">Edit</td></tr>
<script type="text/javascript"><!--
function save_input(obj) {
obj = obj.parentNode;
obj.innerHTML = obj.firstChild.value;
function edit_input(obj) {
var is_checked = obj.checked;
while (obj.tagName!='TR')
obj = obj.parentNode;

var td = obj.getElementsByTagName('TD');
var len = td.length;

if (is_checked) {
var input;

for (var i=0; i<len; i++)
if (td[i].className=='editable') {
input = document.createElement('INPUT');
input.value = td[i].innerHTML;
input.onblur = function() { save_input(this); }
td[i].innerHTML = '';

From http://www.codingforums.com/archive/index.php/t-70763.html

P.S. try to google it.