djonA,
Вариант )))
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$.fn.replaceText = function (e, f, g) {
return this.each(function () {
var a = this.firstChild,
c, b, d = [];
if (a) {
do 3 === a.nodeType && (c = a.nodeValue, b = c.replace(e, f), b !== c && (!g && /</.test(b) ? ($(a).before(b), d.push(a)) : a.nodeValue = b));
while (a = a.nextSibling)
}
d.length && $(d).remove()
})
}; $(window).load(function () {
$("body div").replaceText( /\d+/gi, function f(a)
{
return Array(++a).join('<img src="http://javascript.ru/forum/images/smilies/tongue.gif" alt="">')
} );
});
</script>
<title></title>
</head>
<body>
Т.е если <div id="1">1</div> - вывести 1 звезду
если <div id="2">2</div> - 2 звезды
</body>
</html>