javascript 中js调试
varlastScrollYser=0;functionheartBeatser(){diffY=document.body.scrollTop+document.doc...
var lastScrollYser = 0;
function heartBeatser()
{
diffY = document.body.scrollTop+document.documentElement.scrollTop;
var obj = document.getElementById("mqq");
var percent =1*(diffY-lastScrollYser);
if(percent>0)
{ percent = Math.ceil(percent); }
else
{ percent = Math.floor(percent);}
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";
lastScrollYser = lastScrollYser+percent;
}
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";这一行缺少对象? 展开
function heartBeatser()
{
diffY = document.body.scrollTop+document.documentElement.scrollTop;
var obj = document.getElementById("mqq");
var percent =1*(diffY-lastScrollYser);
if(percent>0)
{ percent = Math.ceil(percent); }
else
{ percent = Math.floor(percent);}
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";
lastScrollYser = lastScrollYser+percent;
}
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";这一行缺少对象? 展开
展开全部
var lastScrollYser = 0;
var percent = 0;
var obj = document.getElementById("mqq");
function heartBeatser()
{
diffY = document.body.scrollTop+document.documentElement.scrollTop;
percent =1*(diffY-lastScrollYser);
if(percent>0)
{ percent = Math.ceil(percent); }
else
{ percent = Math.floor(percent);}
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";
lastScrollYser = lastScrollYser+percent;
}
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";
var percent = 0;
var obj = document.getElementById("mqq");
function heartBeatser()
{
diffY = document.body.scrollTop+document.documentElement.scrollTop;
percent =1*(diffY-lastScrollYser);
if(percent>0)
{ percent = Math.ceil(percent); }
else
{ percent = Math.floor(percent);}
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";
lastScrollYser = lastScrollYser+percent;
}
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
加个if(obj),试下。
if(obj)
{
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";
}
if(obj)
{
obj.style.top = (parseInt(obj.style.top,10)+percent)+"px";
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
var obj = document.getElementById("mqq");
放到函数外面来
即:
var obj = document.getElementById("mqq");
function heartBeatser()
{
放到函数外面来
即:
var obj = document.getElementById("mqq");
function heartBeatser()
{
追问
不行
追答
var percent =1*(diffY-lastScrollYser);
也要放到外面来
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询