摘要: //js Math对象常用方法// 一组数字求最大最小值var max=Math.max(1,2,3,4,8,-9);//求最大值var min=Math.min(1,2,3,4,8,-9);//求最小值console.log(max,min);//返回 8 -9 注意:如果参数中出现字符串 则返回 阅读全文
posted @ 2017-07-17 17:40 太菜 阅读(1340) 评论(0) 推荐(0) 编辑
摘要: var str='hello word'; //查找字符串索引为1的字符 console.log(str[1]);//返回e //这样早期版本浏览器不支持 如IE7 console.log(str.charAt(1));//返回e 浏览器兼容 //查找字符串索引为1的字符编码 console.log 阅读全文
posted @ 2017-07-17 16:53 太菜 阅读(229) 评论(0) 推荐(0) 编辑
摘要: <html><head></head><body><script> //向数组中添加值 var arr=new Array(1,2,3,4,5); var len=arr.push(7,9); console.log(len,arr);//array.push() 在数组末尾添加值, 返回添加后的数 阅读全文
posted @ 2017-07-17 12:08 太菜 阅读(7293) 评论(0) 推荐(0) 编辑
摘要: <!Doctype html><html><head> <meta content="text/html" charset="utf-8" http-equiv="content-type"></head><body><script> /** * @params string type 填写弹出框的 阅读全文
posted @ 2017-07-14 18:30 太菜 阅读(1488) 评论(0) 推荐(0) 编辑
摘要: console.log( parseInt("asd123")); //parseInt 值为字符串 如已字符串开头 返回NaNconsole.log( parseInt("123asd")); //parseInt 值为字符串 如已数字开头 返回数字(123)// parseFloat 与 par 阅读全文
posted @ 2017-07-14 13:54 太菜 阅读(1322) 评论(0) 推荐(0) 编辑
摘要: /*js 非布尔值操作 逻辑与 和 逻辑或*//* * 注:( "" , 0 ,undefined ,NaN ,null 转换为 false) * *//*逻辑与*/console.log(( 1 && 1 && "hello" && 2 && 3 && 4 )); // 第一个转换为true 返回 阅读全文
posted @ 2017-07-14 11:34 太菜 阅读(423) 评论(0) 推荐(0) 编辑
摘要: 用PHP的json_encode来处理中文的时候, 中文都会被编码, 变成不可读的, 类似”\u***”的格式, 还会在一定程度上增加传输的数据量. 而在PHP5.4, 这个问题终于得以解决, Json新增了一个选项: JSON_UNESCAPED_UNICODE, 故名思议, 就是说, Json不 阅读全文
posted @ 2017-01-05 17:03 太菜 阅读(347) 评论(0) 推荐(0) 编辑
摘要: var yearArray = new Array(2009, 2009, 2010, 2010, 2009, 2010);$.unique(yearArray); 返回 2009, 2010, 2009, 2010 var yearArray = new Array(2009, 2009, 201 阅读全文
posted @ 2016-12-29 19:21 太菜 阅读(991) 评论(0) 推荐(0) 编辑
摘要: var reg = /^[\u4E00-\u9FA5]+$/;if(!reg.test(keywordscn)){ alert('请填写中文') return false;} 阅读全文
posted @ 2016-12-29 13:53 太菜 阅读(554) 评论(0) 推荐(0) 编辑