<html>
<head>
<title>测试字符串</title>
<script>
//去空白prototype
String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/g, "");
}
//去空白方法
function trim(str) {
return str.replace(/(^\s*)|(\s*$)/, "");
}
var s = " 123uuuuu ";
alert(s.slice(4, 11));
alert(s.slice(4, 11).length);
alert(s.length);
alert(s.trim().length);
alert(trim(s).length);
alert(trim(s));
var phoneNumOrg = "(130) 51570789";
if(phoneNumOrg != null && phoneNumOrg != "" && phoneNumOrg.length >= 7){
var phoneNum = phoneNumOrg.slice(1,4) + phoneNumOrg.slice(6);
alert("phoneNum: " + phoneNum);
}
function openModelSMSWin(){
var url="http://www.baidu.com";
var nLeft = ( window.screen.width + 300 )/2;
var nTop = ( window.screen.height - 200 )/2;
var sStyle="width=430px,height=290px,left="+nLeft+"px,top="+nTop+"px,scrollbars=no,resizable=no,menubar=no,status=no, location=no";
window.open(url,"即时短信", sStyle);
}
</script>
</head>
<body>
<input type="button" value="模板" onclick="openModelSMSWin();" />
</body>
</html>