例如:
var aaa = 'asdf\
jkl\
qwer'
等同与
var aaa = 'asdfjklqwer'
var s=str.substr(iStart,parseInt(len))+"..."str是需要截取的字符串,iStart是从字符串的哪个位置截取,len是需要截取的长度。例如<html><head><meta http-equiv="Content-Type" content="text/htmlcharset=gb2312">
<title>新建网页 1</title>
<script language=javascript >function showstr()
{
str="abcdefghijklmnopqrstuvwxyz"var s=str.substr(0,5)+"..."
alert(s)
}</script>
</head><body>
<input type=button value="Click Me" onclick ="showstr()">
</body></html>此时显示结果为“abcde...”