Помогло. Работает вот так:
<div id="nem" class="tab" style="background:#000000; width:300px; color:#ffffff; left:0px;top:0px;" >11dfsdsvfsdm,nj ;kljcvscxcvxvc3222sbhjjshbdcvhjkvbshjcbshjcbjsdbch sbf11weqwe333</div>
<script language="JavaScript">
var str=0;
var nem1 = document.getElementById('nem').innerHTML;
var str = nem1.length;
if (str > 20) {nem1 = nem1.slice(0, 5) + '...' + nem1.slice(-5);}
document.getElementById("nem").innerHTML = nem1;
</script>
|