这句之后,或者放在$(function(){
//脚本放在这里;
})
当然要用$(function(){})函数,应包含jquery1.6.js脚本函数。
用挺般使用reduce进行求操作 比数组var arr = [一, 二, 三, 四, 5]现要求数组每项累加值候使用reduce var sum = arr.reduce((o,p)=>o+p)(用es陆箭函数) sum累加浏览器调试下,显示44行Cannot read property 'style' of undefined,其中的this指向的是window对象.修改为:
aLi[i].onmouseout=function()
{
clearTimeout(timer)
var _this=this //更改的地方
timer=setTimeout(function()
{
aDiv[_this.index].style.display='none'//更改的地方
timer=null
},1000)
}