第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

為什么我是if(nextSeconds = curSeconds)才能動態(tài)顯示時間?而老師是if(nextSeconds != curSeconds)。。。。


var r=8;

var marginTop=60;

var marginLeft=30;

const endTime=new Date(2016,8,10,15,10,30); ?//const定義常量,注意:月份是從零開始的,倒計(jì)時時間不能超過24小時

var curShowTimeSeconds=0;


window.onload=function(){

var can=document.getElementById("can");

can.width=1024;

can.height=768;

var ctx=can.getContext("2d");

curShowTimeSeconds=getCurrentShowTimeSeconds();


setInterval(

function(){

render(ctx);

update();

},

50);

}


//獲取當(dāng)前時間與設(shè)定時間的毫秒數(shù)差值

function getCurrentShowTimeSeconds(){

var curTime=new Date();

var ret=endTime.getTime()-curTime.getTime();

ret=Math.round(ret/1000);//轉(zhuǎn)化成秒數(shù)并取整數(shù)

return ret >=0?ret:0;

}


function update(){

var nextShowTimeSeconds=getCurrentShowTimeSeconds();


var nextHours=parseInt(nextShowTimeSeconds/3600);

var nextMinutes=parseInt((nextShowTimeSeconds-nextHours*3600)/60);

var nextSeconds=nextShowTimeSeconds%60;


var curHours=parseInt(curShowTimeSeconds/3600);

var curMinutes=parseInt((curShowTimeSeconds-curHours*3600)/60);

var curSeconds=nextShowTimeSeconds%60;

//console.log(curSeconds+"和"+nextSeconds); ? //這里打印出的curSeconds和nextSeconds是一樣的,不就說明curShowTimeSeconds和nextShowTimeSeconds是一樣的么?


if(nextSeconds = curSeconds){

curShowTimeSeconds=nextShowTimeSeconds;

}


}


function render(content){

content.clearRect(0,0,3000,3000); //防止重復(fù)繪制;

var hours=parseInt(curShowTimeSeconds/3600);

var minutes=parseInt((curShowTimeSeconds-hours*3600)/60);

var seconds=curShowTimeSeconds%60;

renderDigit(marginLeft,marginTop,parseInt(hours/10),content);

renderDigit(marginLeft+15*(r+1),marginTop,parseInt(hours%10),content);

renderDigit(marginLeft+30*(r+1),marginTop,10,content);


renderDigit(marginLeft+39*(r+1),marginTop,parseInt(minutes/10),content);

renderDigit(marginLeft+54*(r+1),marginTop,parseInt(minutes%10),content);

renderDigit(marginLeft+69*(r+1),marginTop,10,content);


renderDigit(marginLeft+78*(r+1),marginTop,parseInt(seconds/10),content);

renderDigit(marginLeft+93*(r+1),marginTop,parseInt(seconds%10),content);

}


function renderDigit(x,y,num,content){

content.fillStyle="rgb(0,102,153)";

for(var i=0; i<digit[num].length; i++)

for(var j=0; j<digit[num][i].length; j++)

if(digit[num][i][j]==1){

content.beginPath();

content.arc(x+2*j*(r+1)+(r+1) , y+2*i*(r+1)+(r+1) , r , 0 , 2*Math.PI);

content.closePath();

content.fill();

}

}


正在回答

1 回答

我知道了。。。寫錯了。。。

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

為什么我是if(nextSeconds = curSeconds)才能動態(tài)顯示時間?而老師是if(nextSeconds != curSeconds)。。。。

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號