摘要: 这个部分代码其实参考jquery的一些函数写法,唯一区别就是调用不用,参数一样. 比如下面的栗子 //设置对象内容 jquery:$('#xxx').html('hello world'); 现在:html(document.getElementById('xxx'),'hello world') 阅读全文
posted @ 2017-07-31 17:18 水上。。。 阅读(100) 评论(0) 推荐(0)
摘要: //cookie //设置cookie function setCookie(name,value,iDay){ var oDate=new Date(); oDate.setDate(oDate.getDate()+iDay); document.cookie=name+'='+value+';e 阅读全文
posted @ 2017-07-31 17:18 水上。。。 阅读(124) 评论(0) 推荐(0)
摘要: 这个方法是在太多了,我之前写的文章(js数组操作–使用迭代方法替代for循环,js关键词变色,数组打乱,数组去重的实现和封装)也有提到,我今天这里就写一种之前没用过的方法。 //ES6新增的Set数据结构,类似于数组,但是里面的元素都是唯一的 ,其构造函数可以接受一个数组作为参数 //let arr 阅读全文
posted @ 2017-07-31 17:17 水上。。。 阅读(150) 评论(0) 推荐(0)
摘要: //去除空格 type 1-所有空格 2-前后空格 3-前空格 4-后空格 function trim(str,type){ switch (type){ case 1:return str.replace(/\s+/g,""); case 2:return str.replace(/(^\s*)| 阅读全文
posted @ 2017-07-31 17:16 水上。。。 阅读(114) 评论(0) 推荐(0)
摘要: $.extend($.fn.validatebox.defaults.rules, { // 该方法只有在保存数据前判断才能生效 hasSame: {//验证名称 validator: function(value, param) { 验证方法体 return false; }, message: 阅读全文
posted @ 2017-07-31 16:52 水上。。。 阅读(71) 评论(0) 推荐(0)
摘要: List<ModelJD> data = myDalJD.GetAllDataList(); List<string> list= new List<string>();list= datalist4.Select(p => p.name).ToList(); //只取name字段,重新生成新的Li 阅读全文
posted @ 2017-07-31 16:37 水上。。。 阅读(275) 评论(0) 推荐(0)