html 的layer的属性,html拼接+layer按钮

//初始存数据

$http.get("querySportteryLeagues.do")

.success(function (result) {

localStorage.setItem ("a",result);

})

$("#endDate").blur(function(){

if($("#startDate").val() =="" && $("#endDate").val() ==""){

$scope.datar=true;

}else{

$scope.datar=false;

};

});

$scope.league = function () {

$scope.startDate = $("#startDate").val();

$scope.endDate = $("#endDate").val();

$http.get('listPheasantLeague.do?startDate=' + $scope.startDate + "&endDate=" + $scope.endDate)

.success(function(result){

//逻辑代码

//console.log(result);  //看此参数返回的是什么数据

if (localStorage.getItem("leagues")) {

var lea =localStorage.getItem("leagues").split(",");

var html = "

";

for (var i in result) {//用javascript的for/in循环遍历对象的属性

html += "

" + i + "";

for (var j = 0; j < result[i].length; j++) {

var a = true;

for (var e = 0; e < lea.length; e++) {

if (lea[e] == result[i][j]) {

html += "

" + result[i][j] + "

"

a = false;

}

}

if (a == true) {

html += "

" + result[i][j] + "

"

}

}

html += "

";

}

html += "

";

} else {

var html = "

";

for (var i in result) {

html += "

" + i + "";

for (var j = 0; j < result[i].length; j++) {

var b = true;

for (var q = 0; q

if(result[i][j] == array[q]){

html += "

" + result[i][j] + "

"

b = false;

}

}

if(b = true){

html += "

" + result[i][j] + "

"

}

}

html += "

";

}

html += "

";

}

layer.confirm(html, {

area: ['40%', 'auto'],

btn: ['竞赛','二期','全选', '全不选', '肯定', '取消'],

btn1: function () {

var jing = localStorage.getItem("a").split(",");

/* $('input:checkbox').each(function() {

if ($(this).prop('checked') ==true) {

$(this).prop("checked",false)

}

}); */

$.each(jing,function(i,item){

$("input[name='lista'][value="+item+"]").prop("checked","true");

});

}, btn2: function () {

/* var jing = localStorage.getItem("a").split(",");

$("input[name='lista']").each(function(){

var checkFlag = true;

for(var q=0;q

if($(this).val() == jing[q]) {

checkFlag = false;

}

}

if(checkFlag) {

$(this).prop("checked",true);

}

});*/

/* $('input:checkbox').each(function() {

if ($(this).prop('checked') ==true) {

$(this).prop("checked",false)

}

}); */

$("input[name='checkbox']").each(function(){

if($(this).prop("checked")) {

$(this).prop("checked",false);

}

});

$.each(pheasantLeaguesS2,function(i,item){

$("input[name='lista'][value="+item+"]").prop("checked","true");

});

return false;

}, btn3: function () {

$("#list :checkbox").prop("checked", true);

return false;

}, btn4: function () {

$("#list :checkbox").prop("checked", false);

return false;

}, btn5: function () {

var valArr = new Array;

$("input[name='lista']:checked").each(function (i) {

valArr[i] = $(this).val();

});

var leagues = "";

if (valArr.join(',')) {

leagues = valArr.join(',');//转换为逗号隔开的字符串'

}

/* var obj  ="";

if(leagues !=""){

obj = leagues.split(",");

} */

localStorage.setItem("leagues",leagues);

}, end: function () {

}

});

})

//console.log(localStorage.getItem("leagues").split(",").length,"aaa");

}javascript

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值