fanglor | 八月 26, 2011 | Leave your comment
JS自身没有 trim这样的函数 来去除左右空格 ,必须通过自定义函数来实现这样的功能了。
代码如下:
function trim(str){ return str.replace(/(^\s*)|(\s*$)/g, ""); }
js去除左右空格函数 was posted on 八月 26, 2011 at 4:26 下午 in javascript学习, 北京php培训 and tagged as js去除左右空格. It was last modified on 八月 26, 2011 at 4:27 下午. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response or trackback from your site.
Share on Twitter, Facebook, Delicious, Digg, Reddit
Your email will not be published or shared. Required fields are marked *
名称 *
电子邮件 *
网站
Comment
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">
反垃圾验证码(必填)* 请输入图片中的字符以验证你并非垃圾机器人. 点击图片收听验证码的语音版.