/ Published in: JavaScript
Expand |
Embed | Plain Text
var stat = false; function edit(id, txt){ txt = typeof(txt) != 'undefined' ? txt : 'Salva'; var el = document.getElementById(id); if(!stat){ var cmd = '<br /><input type="submit" value="'+ txt +'" onclick="save(\''+ id +'\')" />'; el.innerHTML = '<textarea cols="100%" rows="8%" id=\"edit-'+ id +'\">' + el.innerHTML + '</textarea>' + cmd; stat = true; } } function save(id){ var elm = document.getElementById(id); var rep = document.getElementById('edit-'+ id); var str = rep.value; elm.innerHTML = str; stat = false; }
Comments
Subscribe to comments
You need to login to post a comment.

hjgffghfj,gjhgfjhfgjf