常用js
来源:互联网 发布:木工数控机床编程 编辑:程序博客网 时间:2024/06/04 00:25
//正则检验function check_reg(reg,str) { if(reg.test(str)){ return true; } else { return false; }}//去除前后空格String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g,'')};//去除左边空格String.prototype.ltrim = function () { return this.replace(/^\s*/g,'')};//去除右边空格String.prototype.rtrim = function () { return this.replace(/\s*$/g,'')};//js 的String有去空格的方法a.trim()a.trimLeft()a.trimRight()//获取XMLHttpRequest 对象function xmlhttpRequest(){ var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } return xmlhttp}//ajax封装函数,xmlhttp:XMLHttpRequest 对象,func:处理响应的函数,url:请求的地址,method:请求方式,param:请求参数function myajax(xmlhttp,func,url,method="GET",param="") { xmlhttp.onreadystatechange = func; xmlhttp.open(method,url,true); if (method == "POST"){ xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); } xmlhttp.send(param);}
阅读全文
0 0
- 常用js
- 常用js
- 常用JS
- 常用js
- js 常用
- JS常用
- js常用
- 常用js
- 常用js
- 常用JS
- 常用 js
- 常用JS
- js常用...
- 常用JS
- js常用
- 常用js
- js常用
- 常用js
- 大数据|意不意外?今年卖得最好的月饼是这个馅的……
- VS C#实现简单拼图游戏
- JZOJ 5399. 【NOIP2017提高A组模拟10.7】Confess
- python进行文本分类,基于word2vec,sklearn-svm对微博性别分类
- Android LinearLayout 线性布局
- 常用js
- Linux命令行笔记
- 学习Docker(2017-10-7)
- 不重启修改计算机名
- Bless You Autocorrect 字典树+bfs
- ajax
- Linux中MySql数据库的使用
- 统计字符串中的不同字符个数
- codeforces round #438 C. Qualification Rounds