基於JS的問卷調查

來源:互聯網
上載者:User

標籤:clock   變化   bsp   https   靜態   check   use   src   logs   

主要工作

因為代碼不好展示,也不好截長圖,可以去看我的GitHub地址:https://github.com/14glwu/MyBlog/blob/master/questionnaire.html

JS主要為計時器以及問卷的相關業務處理

部分:

部分代碼:

計時器:

<script type="text/javascript">/*關於計時器部分的JS代碼*/    var se,ss=99;m=10,h=0,s=0;     var h1,m1,s1;    function second(){     if(ss<0){s-=1;ss=100;}      if(s<0){m-=1;s=59;}      if(m<0){h-=1;m=59;}     if(h<0) {        clearInterval(se);        alert("考試時間到");        h=0;m=0;s=0;ss=0;    }    h1=checkTime(h);    m1=checkTime(m);    s1=checkTime(s);    t=h1+":"+m1+":"+s1;   //時分秒運算    document.getElementById("showtime").value=t;     //這有一個給id為showtime的input賦值的語句,可以實現動態計時。    //其實所謂的動態計時,就是在很短的時間裡不停給顯示時間的地方更新數值,由於速度很快,這樣計時器看起來時刻都在變化。但其實不是的,它從本質上還是靜態,這跟js的偽多線程原理是一樣的。     ss-=1;     }      function checkTime(i){        if (i<10) {i="0"+i}        return i;    }    function startclock(){se=setInterval("second()",10);}  //這個函數是要放到按鈕的click事件上的    function pauseclock(){clearInterval(se);}    //這個函數是要放到按鈕的click事件上的    function stopclock(){clearInterval(se);ss=99;m=10;h=0;s=0;}   //這個函數是要放到按鈕的click事件上的    window.onload=startclock();</script><!--  end:計時器指令碼 -->

 

基於JS的問卷調查

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.