复制代码代码如下:
<script>
function csubstr(str,len){
if(str.length>10){
return str.substring(0,len)+"...";
}else{
return str;
}
}
</script>
<div ><script>document.write(csubstr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10));</script></div>
复制代码代码如下:
<script>
function csubstr(str,len){
if(str.length>10){
return str.substring(0,len)+"...";
}else{
return str;
}
}
</script>
<div ><script>document.write(csubstr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10));</script></div>