07 2017 档案
摘要:console.log(screen.availWidth,screen.availHeight);//获取屏幕的宽和高(除 Windows 任务栏之外))console.log(screen.width,screen.height);//获取屏幕的宽和高(包含Windows 任务篮))consol
阅读全文
摘要:history.back();//后退一个历史记录相当于 history.go(-1); history.forward();//前进一个历史记录相当于 history.go(1);
阅读全文
摘要:location.href ='url' //有历史记录 location.replace=‘url’ //没有历史记录 location.reload() //缓存刷新 ocation.reload(true) 强制刷新
阅读全文
摘要://js date对象常用方法//创建事件对象var now = new Date(); //不传参情况下默认返回当前时间//获取年var y=now.getFullYear();//获取月var m=now.getMonth()+1;//返回0-11//获取日var d= now.getDate(
阅读全文
摘要://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 注意:如果参数中出现字符串 则返回
阅读全文
摘要:var str='hello word'; //查找字符串索引为1的字符 console.log(str[1]);//返回e //这样早期版本浏览器不支持 如IE7 console.log(str.charAt(1));//返回e 浏览器兼容 //查找字符串索引为1的字符编码 console.log
阅读全文
摘要:<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() 在数组末尾添加值, 返回添加后的数
阅读全文
摘要:<!Doctype html><html><head> <meta content="text/html" charset="utf-8" http-equiv="content-type"></head><body><script> /** * @params string type 填写弹出框的
阅读全文
摘要:console.log( parseInt("asd123")); //parseInt 值为字符串 如已字符串开头 返回NaNconsole.log( parseInt("123asd")); //parseInt 值为字符串 如已数字开头 返回数字(123)// parseFloat 与 par
阅读全文
摘要:/*js 非布尔值操作 逻辑与 和 逻辑或*//* * 注:( "" , 0 ,undefined ,NaN ,null 转换为 false) * *//*逻辑与*/console.log(( 1 && 1 && "hello" && 2 && 3 && 4 )); // 第一个转换为true 返回
阅读全文
浙公网安备 33010602011771号