摘要:
item 表示数组中的数据 index 表示下标 array 表示遍历的数组 item 表示数组中的数据 index 表示下标 array 表示遍历的数组 while do...while for for(var i = 1 ; i <= 100 ; i++){ break } for(var i
阅读全文
posted @ 2019-01-21 10:40
伊人怎会持宠而骄
阅读(138)
推荐(0)
编辑
摘要:
判断非数字 isNAN() 括号中为非数字 isNAN() 括号中为非数字 测试变量的类型 typeof() typeof typeof() 结果都是string typeof() typeof typeof() 结果都是string
阅读全文
posted @ 2019-01-21 10:40
伊人怎会持宠而骄
阅读(87)
推荐(0)
编辑
摘要:
关联数组转对象 json_encode() var arr=( array("sname"=>"jack") ) json_encode( arr ) json_encode() var arr=( array("sname"=>"jack") ) json_encode( arr ) 对象转字符串
阅读全文
posted @ 2019-01-21 10:37
伊人怎会持宠而骄
阅读(118)
推荐(0)
编辑
摘要:
方法一 set 数组去重 定义一个函数 实现数组去重 返回去重后的数组 function norepeat( arr ){ var set = new Set( arr ); return Array.from( set );(返回去重后的数组) return Array.from( new Set
阅读全文
posted @ 2019-01-21 10:36
伊人怎会持宠而骄
阅读(164)
推荐(0)
编辑
摘要:
滚动条的兼容写法(谷歌chrome) document.documentElement.scrollTop || document.body.scrollTop document.documentElement.scrollTop || document.body.scrollTop 阻止浏览器默认
阅读全文
posted @ 2019-01-21 10:34
伊人怎会持宠而骄
阅读(94)
推荐(0)
编辑
摘要:
设置cookie function setCookie( key , value ,day ){ if( day ){ var now = new Date(); now.setDate( now.getDate() + day ); document.cookie = key +"=" + val
阅读全文
posted @ 2019-01-21 10:28
伊人怎会持宠而骄
阅读(112)
推荐(0)
编辑
摘要:
定义一个函数 功能实现通过id查找页面元素 返回值就是一个页面元素 function $id(id){ return document.getElementById(id); } function $id(id){ return document.getElementById(id); } 定义一个
阅读全文
posted @ 2019-01-21 10:27
伊人怎会持宠而骄
阅读(158)
推荐(0)
编辑