工作中遇到js相关关键字用法

URI是唯一标识,但是不一定能找到,不是定位资源,是标识资源,
URL是唯一标识,但同时还能找到,可以定位资源。
URL是URI的子集   



 前台向后台传递汉字:encodeURIComponent(汉字)

$("#ID").attr("class","validate[required,isNumeric[6,2]] form-control");
$(this).attr("style","display: none;");
$("#ID").attr("style","display: '';");
$("#ID").removeClass("container-include-mln"); 
$("#ID").addClass("container-include-mln"); 
$("#ID").css("display","none");
$("#ID",parent.document).css("display","");



document.getElementById("ID").style.display="";
document.getElementById("ID").style.display="none";
document.getElementById("ID").readOnly=false;

   <li title="0.00"  YC>0.00</li>
	$("li[YC]").each(function(){
		ids.push(this.id);
	});

for(var k in list){
   console.log(k+'========'+list[k]);
}
 $.each(data.xData,function(i,n){
     console.log(i+'========'+n);
})	       		
$.each(data,function(){
     console.log('========'+this.psId);
	 for(var key in this){
		oneModel.find("#"+key).text(this[key]);
	 }
});
$('.box').each(function() {
     console.log($(this).attr('dataId'));
     console.log($(this).position().left);
     console.log($(this).position().top);
});




***********************************************************
var arr = [ "aaa", "bbb", "ccc" ];
$.each(arr, function(i,a){
alert(i); // i 是循环的序数
alert(i); // a 是值
});
处理json
var obj = { one:1, two:2, three:3};
$.each(obj, function(key, val) {
alert(key); //键
alert(val); //值
});
***********************************************************

//闭包

function a() {
			    var i = 0;
			    function b() {
			        console.log(i--);
			    }
			    function c() {
			        console.log(i++)
			    }
			     
			    return [b, c]
			}
			var m = a();
			m[0]();0
			m[0]();-1
			m[0]();-2
			m[1]();-3
			m[1]();-2
			m[1]();-1

//回调

function doSomething(callback){
     callback(1,2);
}
function numberAdd(a,b){
     document.write(a+b);
}
doSomething(numberAdd);//3

// 转义${}类型参数

function getcollect(el) {
	var regexp = new RegExp("\\\$\\{(.*?)\\}", "g");
	var rs = null;
	while ((rs = regexp.exec(el)) != null) {
		el = eval("el.replace(rs[0],paramMap." + rs[1] + ")");
	}
	return el;
}



location.href=encodeURI(getcollect(url)).replace("#","%23");
window.location.href='/***/***/***.action?name='+encodeURIComponent('汉字');


$.ajax({
	type:"POST",
	url:"/***/***/***.action",
	dataType : "json",
	async:true,
	data : {
		eqid:$('#eqid').val()
	},
      	error: function(data,transport){ 
      	},
      	success: function(data){
      	}
});
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值