Jquery的validate,清除form方法,显示密插件,正则特殊字符处理,js的call用法,ajax,h5支持情况,elclipse tomcate去掉项目名,js 的原型

1 jquery validate获取焦点时 去掉错误信息

jQuery.validator.setDefaults({

   focusCleanup: true 

});

2 清除form方法

   jQuery("#a")[0].reset();

   jQuery("#a").validate().resetForm();

2 jquery 显示密码插件

jquery.toggle-password.js

   $('#b').togglePassword({       

      el:'#c'

   });

3 正则表达式

所有特殊字符

/^[!@#\$%\^&\*\?\-_\+=~\\\|\(\)\[\]]{1,35}$/.test('!@#$%^&*-_+=()[]\|')== true

 

需要转移的字符一般都是正则定义的字符

4 encodeURI和encodeURIComponent区别

//不处理一些特殊字符

encodeURI('abc##abc')

"abc##abc"

//处理一些特殊字符

encodeURIComponent('abc##abc')

"abc%23%23abc"

http://www.cnblogs.com/huangjacky/p/4015690.html

5  call方法多继承和单继承—apply—concat用法字符串和数组—join返回字符串

         <scripttype="text/javascript">

                   functionadd(a,b){

                            console.log(a+b);

                   }

                   functionddd(a,b){

                            console.log(a-b);

                   }

                   add.call(ddd,3,1);

                   console.log(this==window);

 

                   functionAni(){

                            this.name='aa';

                            this.showName=function(){

                                     console.log(this.name);

                            }

                   }

                   functionCat(){

                            this.name='cat';

                   }

 

                   varcat=new Cat();

                   varani=new Ani();

                   ani.showName.call(cat);

 

                   //继承 多继承和单继承

                   functionf1(myname){

                            this.name=myname;

                            this.showname=function(){

                                     console.log(this.name);

                            };

                   }

                   functionother(myname,ok){

                            this.getok=function(){

                                     console.log(ok);

                            }

                   }

                   functionf2(myname){

                            f1.call(this,myname);

                            other.call(this,myname,'iam success');

                   }

                   varf_2=new f2('f2');

                   f_2.showname();

                   f_2.getok();

 

                   //apply userage 参数必须是数组

                   ani.showName.apply(cat,[]);

                   //join usage

                   console.log([1,2,3,4].join('-'));

         </script>

5 ajax 在运行请求过程中进行数据处理

      user.listenAjax= function(){

         user.config.$form.ajaxStart(function(){

            console.log(1);

            $("#ajaxMsg").show();

         });

 

         a.ajaxError(function(event,request,settings){

            console.log(3);

            $("#ajaxMsg").hide();

         });

         a.ajaxSuccess(function(event,request,settings){

            console.log(4);

            $("#ajaxMsg").hide();

         });

      };

6 h5c3浏览器版本支持情况

http://www.zhangxinxu.com/wordpress/2010/04/css3html5各浏览器支持情况一览表

7 transform 动画

  transform: rotate | scale | skew | translate|matrix;

8 如何去掉的方法tomcat 上项目名方法

<Context docBase="projectname"path="/" reloadable="true" source="org.eclipse.jst.jee.server:projectname"/>

</Host>

9 原型莲

     <scripttype="text/javascript">

                  function Flow(v1){

              this.name='proto';

              this.v1=v1;

         }    ;

         varflow=new Flow();

         Flow.prototype.open= function(){

              console.log('iopen'+this.name);

         }   

         flow.open();

         var flow2=newFlow()

         flow2.open();

         Flow.prototype.name='prototypeme';

         Flow.prototype.open();

         Flow.prototype.hello='good';

         Flow.prototype.v2=10;

         Flow.prototype.cal=function(v3){

              this.v2=parseInt(this.v2,10);

              console.log(this.v1+this.v2+v3);

         }

         console.log(Flow.prototype.hello);

         newFlow(100).cal(200);

 

         //学习闭包方法和用途

         functionCollese(name){

              this.name=name;

         }

         var collese= new Collese('rash');

         Collese.prototype.getName=function(){

              console.log(this.name);

         }

         collese.getName();

 

         varcollese2= function Collese2(name){

              this.name=name;

         }

         collese2.getName=function(){

              console.log(this.name);

         }

         collese2.getName();

         collese2.name='collesecopy';

         collese2.getName();

 

         varcollese3 = function (){

              varobject=new Object();

              object.name='sun';

              object.getName=function(){

                   console.log(object.name);

              };

              returnobject;

         }

         console.log(newcollese3().name);

         newcollese3().getName();

 

         varcollese4 = (function(QQS){

              return{

                   getName:function(){

                       QQS.getName();

                   },

                   setName:function(name){

                       console.log("before"+QQS.name);

                       QQS.name=name;

                       console.log("after"+QQS.name);

                   }

              }

         })(collese2);

         collese4.getName();

         collese4.setName('moon');

         collese4.getName();

 

         var collese5=function(){

              return{

                   getFive:function(){

                       return5;

                   },

                   getSix:function(){

                       return6;

                   }

              }

         }();

         console.log(collese5.getFive());

         console.log(collese5.getSix());  </script>

10tf

//公共常量插件
TF.Constants = (function() {
var constants = {};


function initPao(pao, level) {
switch (level) {
case 1: //jiguanqiang
pao.name = 'longgun'
pao.juli = 1000;
pao.power = 10;
case 2: //icon pao
pao.name = 'gangpao'
pao.juli = 100;
pao.power = 25;
case 999900: //hedan
pao.name = 'hedan'
pao.juli = 999900;
pao.power = 999900;
case 999901: //qingdan
pao.name = 'qingdan'
pao.juli = 999990;
pao.power = 999990;
}
return pao;
}
return constants;
})();
TF.Obj=(function($){//pao,block,arnimy
var obj ={
name:'',
id:'',
type:'',
place:''
};
return obj;
})(jQuery);
TF.Scene = (function(){//场景 主要是位置
var scene={};
scene.init = function(){


};
return scene;
})();
TF.AutoPath = (function($){
var path={};
path.setBlockPalce=function(mapdata){


};
return path;
})(jQuery);


TF.Map=(function($){
var map={
block:[],
army:[],
pao:[]
};
map.updateBlockMap=function(obj){//更新位置数据
if(obj){
for (var i = 0; i < map.block.length; i++) {
if(obj.id==map.block[i].id){
map.block[i]=obj;
}
};
}
};
map.addBlockMap=function(obj){//第一次出现加上数据
map.block.push(obj);
};
map.removeBlockMap=function(obj){//被消灭或者结束GM消失
map.block.filter(function(item,index,array){
return item.id!=obj.id;
});
};


return map;
})(jQuery);
//设备插件
(function($, cons) {
var tf = {};


function Pao(level) {
cons.initPao(level);
};


function Guai(level) {


};


tf.init = function() {
var longGun = new Pao(1);
var iconPao = new Pao(2);
};


$(tf.init);
})(jQuery, TF.Constants);



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

静山晚风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值