I have found the following script on the net, and it does exactly what I want it to do except it won’t save the info. Can anyone help. I am trying use a table in HTML and have the cell be editable online. This script works great but won’t save the changes. What am I doing wrong. I am new at this so please work with me.
Here is what I have:
<SCRIPT>
function editCell (cell) {
if (document.all) {
cell.innerHTML =
‘<INPUT ‘ +
‘ ID=”editCell”‘ +
‘ ONCLICK=”event.cancelBubble = true;”‘ +
‘ ONCHANGE=”setCell(this.parentElement, this.value)” ‘ +
‘ ONBLUR=”setCell(this.parentElement, this.value)” ‘ +
‘ VALUE=”‘ + cell.innerText + ‘”‘ +
‘ SIZE=”‘ + cell.innerText.length + ‘”‘ +
‘>’;
document.all.editCell.focus();
document.all.editCell.select();
}
else if (document.getElementById) {
cell.normalize();
var input = document.createElement(‘INPUT’);
input.setAttribute(‘value’, cell.firstChild.nodeValue);
input.setAttribute(‘size’, cell.firstChild.nodeValue.length);
input.onchange = function (evt) { setCell(this.parentNode,
this.value); };
input.onclick = function (evt) {
evt.cancelBubble = true;
if (evt.stopPropagation)
evt.stopPropagation();
};
cell.replaceChild(input, cell.firstChild);
input.focus();
input.select();
}
}
function setCell (cell, value) {
if (document.all)
cell.innerText = value;
else if (document.getElementById)
cell.replaceChild(document.createTextNode(value), cell.firstChild);
}
</SCRIPT>
<TABLE BORDER=”1″>
<TR>
<TD ONCLICK=”editCell(this);”>
jsunity
</TD>
<TD ONCLICK=”editCell(this);”>
erstaunt
</TD>
<TD ONCLICK=”editCell(this)”>
immer wieder
</TD>
</TR>
</TABLE>