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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何為每個(gè)問題創(chuàng)建測(cè)驗(yàn)倒數(shù)計(jì)時(shí)器

如何為每個(gè)問題創(chuàng)建測(cè)驗(yàn)倒數(shù)計(jì)時(shí)器

泛舟湖上清波郎朗 2022-08-18 10:48:52
我想為測(cè)驗(yàn)創(chuàng)建一個(gè)倒數(shù)計(jì)時(shí)器,該測(cè)驗(yàn)將在下一個(gè)問題上重置,如果時(shí)間用完并且玩家尚未選擇答案,也可以轉(zhuǎn)到下一個(gè)問題。任何人都可以幫我創(chuàng)建這個(gè)嗎?var counter = 10;setInterval(function () {  counter--;  if (counter >= 0) {    id = document.getElementById('count');    id.innerHTML = counter;  }  if (counter === 0) {    id.innerHTML = 'Times Up!';  }}, 1000);'''
查看完整描述

1 回答

?
哈士奇WWW

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超6個(gè)贊

這是適合您的基本工作代碼。玩一玩它以獲得您想要的結(jié)果。祝您編碼愉快!


var counter = 10;             //Time counter

var questionsCount = 0;       //Questions counter


//Questions array

var questions = [

   "Question 1","Question 2","Question 3"


questionDivId =  document.getElementById('question');


setInterval(function () {

    counter--;


    if (counter >= 0) {

        id = document.getElementById('count');

        id.innerHTML = counter;

    }

    if (counter === 0) {

        id.innerHTML = 'Times Up!';

        counter = 10;

        questionsCount++;

    } 

    

    //To check if all questions are completed or not

    if (questionsCount === questions.length){

        questionDivId.innerHTML = "Well Played! Game is over";

        id.innerHTML = "";

    } else{

        questionDivId.innerHTML = questions[questionsCount];

    }   

}, 1000);


//To go to the next question

function goToNextQuestion() {

    questionsCount++;

    counter = 10;

}

<div>

    <h1 id="question"></h1>

    <h1 id="count"></h1>

    <button onclick="goToNextQuestion()">Next</button>

</div>


查看完整回答
反對(duì) 回復(fù) 2022-08-18
  • 1 回答
  • 0 關(guān)注
  • 126 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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