为了账号安全,请及时绑定邮箱和手机立即绑定

请大家帮我看看这段JS代码为什么会报错?

请大家帮我看看这段JS代码为什么会报错?

侃侃尔雅 2019-05-11 09:49:23
相关代码//请把代码文本粘贴到下方(请勿用图片代替代码)打气球2*{margin:0;padding:0;}html,body{position:relative;background:url(images/bg.jpg);background-size:cover;}div{position:absolute;}#scores,#time{color:white;font-size:20px;line-height:150%;font-style:normal;}您的得分:0剩余时间://获得分数元素varscores=document.getElementById("scores");//获得时间元素vartime=document.getElementById("time");//有效性varuseful=true;//分数varscoress=0;//计时时间vartimes=30000;//构造函数ballonfunctionBallon(score,color){this.score=score+1;//元素的初始样式this.left=parseInt(Math.random()*1900);this.top=700;this.width=100;this.height=100;this.color=color;//创建元素this.dom=document.createElement("div");document.body.appendChild(this.dom);//渲染元素//this.render(color);//气球飞行this.fly();//绑定气球点击varThis=this;this.dom.onmousedown=function(){This.kill();//console.log(This.score,scoress);scoress+=This.score;scores.innerHTML="您的得分:"+scoress;};}Ballon.prototype.render=function(){this.dom.style.left=this.left+"px";this.dom.style.top=this.top+"px";this.dom.style.width=this.width+"px";this.dom.style.height=this.height+"px";this.dom.style.backgroundColor=this.color;}Ballon.prototype.fly=function(){vars=this.score*1;varThis=this;nn=0;this.timer=setInterval(function(){This.top-=s;if(This.top
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 442 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号