• <noscript id="ggggg"><dd id="ggggg"></dd></noscript>
    <small id="ggggg"></small> <sup id="ggggg"></sup>
    <noscript id="ggggg"><dd id="ggggg"></dd></noscript>
    <tfoot id="ggggg"></tfoot>
  • <nav id="ggggg"><cite id="ggggg"></cite></nav>
    <nav id="ggggg"></nav>
    成人黃色A片免费看三更小说,精品人妻av区波多野结衣,亚洲第一极品精品无码,欧美综合区自拍亚洲综合,久久99青青精品免费观看,中文字幕在线中字日韩 ,亚洲国产精品18久久久久久,黄色在线免费观看

    Javascrpit之打字機效果

    2018-6-25    seo達人

    如果您想訂閱本博客內容,每天自動發到您的郵箱中, 請點這里

    今天來看看怎么實現炫酷的打字機效果。即把一段話一個字一個字的顯示出來。

    效果圖:

    實現思路:

    首先規定好顯示字數的速度即settimeout執行間隔用來控制每個字之間輸出速度。再把判斷段落的總字數,循環段落總字數來實現一個字一個字的輸出。

    js代碼:

    
        
    1. var theNewsNum;
    2. var theAddNum;
    3. var totalNum;
    4. var CurrentPosion=0;
    5. var theCurrentNews;
    6. var theCurrentLength;
    7. var theNewsText;
    8. var theTargetLink;
    9. var theCharacterTimeout;
    10. var theNewsTimeout;
    11. var theBrowserVersion;
    12. var theWidgetOne;
    13. var theWidgetTwo;
    14. var theSpaceFiller;
    15. var theLeadString;
    16. var theNewsState;
    17. function startTicker(){
    18. // ------ 設置初始數值
    19. theCharacterTimeout = 50;//字符間隔時間
    20. theNewsTimeout = 2000;//新聞間隔時間
    21. theWidgetOne = "_";//新聞前面下標符1
    22. theWidgetTwo = "-";//新聞前面下標符
    23. theNewsState = 1;
    24. theNewsNum = document.getElementById("incoming").children.AllNews.children.length;//新聞總條數
    25. theAddNum = document.getElementById("incoming").children.AddNews.children.length;//補充條數
    26. totalNum =theNewsNum+theAddNum;
    27. theCurrentNews = 0;
    28. theCurrentLength = 0;
    29. theLeadString = " ";
    30. theSpaceFiller = " ";
    31. runTheTicker();
    32. }
    33. // --- 基礎函數
    34. function runTheTicker(){
    35. if(theNewsState == 1){
    36. if(CurrentPosion<theNewsNum){
    37. setupNextNews();
    38. }
    39. else{
    40. setupAddNews();
    41. }
    42. CurrentPosion++;
    43. if(CurrentPosion>=totalNum||CurrentPosion>=1){
    44. CurrentPosion=0;//最多條數不超過num_gun條
    45. }
    46. }
    47. if(theCurrentLength != theNewsText.length){
    48. drawNews();
    49. }
    50. else{
    51. closeOutNews();
    52. }
    53. }
    54. // --- 跳轉下一條新聞
    55. function setupNextNews(){
    56. theNewsState = 0;
    57. theCurrentNews = theCurrentNews % theNewsNum;
    58. theNewsText = document.getElementById("AllNews").children[theCurrentNews].children.Summary.innerText;
    59. theTargetLink = document.getElementById("AllNews").children[theCurrentNews].children.Summary.children[0].href;
    60. theCurrentLength = 0;
    61. document.all.hottext.href = theTargetLink;
    62. theCurrentNews++;
    63. }
    64. function setupAddNews() {
    65. theNewsState = 0;
    66. theCurrentNews = theCurrentNews % theAddNum;
    67. theNewsText = document.getElementById("AllNews").children[theCurrentNews].children.Summary.innerText;
    68. theTargetLink = document.getElementById("AllNews").children[theCurrentNews].children.Summary.children[0].href;
    69. theCurrentLength = 0;
    70. document.all.hottext.href = theTargetLink;
    71. theCurrentNews++;
    72. }
    73. // --- 滾動新聞
    74. function drawNews(){
    75. var myWidget;
    76. if((theCurrentLength % 2) == 1){
    77. myWidget = theWidgetOne;
    78. }
    79. else{
    80. myWidget = theWidgetTwo;
    81. }
    82. document.all.hottext.innerHTML = theLeadString + theNewsText.substring(0,theCurrentLength) + myWidget + theSpaceFiller;
    83. theCurrentLength++;
    84. setTimeout("runTheTicker()", theCharacterTimeout);
    85. }
    86. // --- 結束新聞循環
    87. function closeOutNews(){
    88. document.all.hottext.innerHTML = theLeadString + theNewsText + theSpaceFiller;
    89. theNewsState = 1;
    90. setTimeout("runTheTicker()", theNewsTimeout);
    91. }
    92. window.onload=startTicker;
    藍藍設計m.lzhte.cn )是一家專注而深入的界面設計公司,為期望卓越的國內外企業提供卓越的UI界面設計、BS界面設計 、 cs界面設計 、 ipad界面設計 、 包裝設計 、 圖標定制 、 用戶體驗 、交互設計、 網站建設 、平面設計服務

    日歷

    鏈接

    個人資料

    藍藍設計的小編 http://m.lzhte.cn

    存檔

    主站蜘蛛池模板: 性欧美精品xxxx| 久久黄色免费偷拍尿尿| 老司机福利院| 97精品久久九九中文字幕| 国产熟睡乱子伦视频观看看| 国产一区二区精品自拍| 一级毛片在线播放免费观看| 久久精品成人免费看| 成人三级电影在线观看| 国产精品吹潮在线观看 | 18禁又污又黄又爽的网站不卡 | 亚洲一区二区三区在线直播| 少妇人妻偷人一区二区| 人妻少妇啊灬啊灬用力…啊快| 狠狠操网站| 国产女主播喷水视频在线观看| 久久99综合精品国产首页| 淫爽导航| 欧美日本在线一区二区三区| 福利第一页| 亚洲AV无码成人精品区狼人影院 | 人人妻人人添人人爽日韩欧美| 亚洲系列中文字幕一区二区| 日韩激情视频| 久久久波多野结衣av一区二区| 亚洲乱亚洲乱妇22p中文影视| 中文字幕在线精品人妻| 殴美性爱| GV无码免费无禁网站男男| 日本中文字幕有码在线视频| 国产69精品久久久久孕妇| 内射中出无码护士在线| 亚洲色无码专区在线观| 色综合欧美在线视频区| 日韩美女乱淫试看视频多人 | 波多野结衣视频网站| 最新欧美精品一区二区三区不卡| 成人电影一区二区三区| 乱伦导航| 97久久久亚洲综合久久88| 国产成人AV无码精品无毒|