由document.getElementByID().value得到的值如何去掉前后空格 如题在JSP页面得到的这个字符串,如何去掉前后空格? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String.prototype.trim=function(.){return this.replace(/(^\s*)|(\s*$)/g, "");}alert(document.getElementByID('aaa').value..trim()) 上面是删除所有空格以及不显示的字符的这个是仅删除空格:String.prototype.rtrimblank=function(){return this.replace(/([.\w]*)[ ]+$/,"$1");}lert(document.getElementByID('aaa').value..trim()) lert(document.getElementByID('aaa').value..trim())--------->alert(document.getElementByID('aaa').value.trim()) reg.js( jQuery用烂了,所以自己手写的javascript框架 ,附带说明 ) JSP网页内存泄露问题 在线等,急急急! 有清楚点的javascript权威指南吗?? IE7中为什么不能正常显示? 怎么编辑option 谁能帮我看看下面代码的功能,谢谢! 谁能给我一段javascript写的urlencode函数啊,要编码UTF-8的汉字的 怎么让下拉菜单能输入内容? “如果图片宽度大于75则重设为75”如何实现?已知的一种方法有问题 在求一个函数 js 子窗口刷新父窗口后,如何继续调用父窗口的js方法
String.prototype.trim=function(.){return this.replace(/(^\s*)|(\s*$)/g, "");}
alert(document.getElementByID('aaa').value..trim())
这个是仅删除空格:
String.prototype.rtrimblank=function(){return this.replace(/([.\w]*)[ ]+$/,"$1");}
lert(document.getElementByID('aaa').value..trim())
--------->
alert(document.getElementByID('aaa').value.trim())