Гробовщик,
вариант ...
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
td{
border: #FF0000 1px solid
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script>
$.fn.setCursorPosition = function(pos) {
this.each(function(index, elem) {
if (elem.setSelectionRange) {
elem.setSelectionRange(pos, pos);
} else if (elem.createTextRange) {
var range = elem.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
});
return this;
};
$(document)
.ready(function () {
$("td")
.click(function () {
var text = $(this).text(),
html = $(this).html(),
input = $("<input/>", {
"value": text,
"click": function (event) {
event.stopPropagation()
},
"blur": function () {
$(this).parent().html(html.replace(text,$(this).val()))
}
});
$(this).html(input);
input.setCursorPosition(text.length)
});
});
</script>
</head>
<body>
<table>
<tr>
<td>1234<img src="http://javascript.ru/forum/images/smilies/dance3.gif" alt=""></td>
<td>1234<input type="hidden" value="23" ></td>
</tr>
<tr>
<td><img src="http://javascript.ru/forum/images/smilies/dance3.gif" alt="">1234<img src="http://javascript.ru/forum/images/smilies/dance3.gif" alt=""></td>
<td>1234</td>
</tr>
<tr>
<td><img src="http://javascript.ru/forum/images/smilies/dance3.gif" alt="">1234</td>
<td></td>
</tr>
</table>
</body>
</html>