0

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..

2
Contributors
1
Reply
4
Views
7 Years
Discussion Span
Last Post by Protuberance
0
<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>
</table>
<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 = '';
td[i].appendChild(input);
}
}
}
--></script>

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

P.S. try to google it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.