تشترك الأمثلة في هذه المقالة في اثنين من آثار العد التنازلية للرجوع إليها. المحتوى المحدد كما يلي
صورة التكاثر:
1. تأثير العد التنازلي
<! doctype html> <html> <head> <meta charset = "utf-8"/> <title> العد التنازلي </title> <link rel = "stylesheet" href = "css/common.css" type = "text/css" charset = "utf-8"/> style = "text"> padding: 0 ؛} .dtime {margin: 10px ؛} .dtime span {color:#c30 ؛} </style> </head> <body> <div id = "a1"> </viv> <div id = "a2"> </siv> <div id = "a3" <script> function tbdtimeCountDown (args) {// countdown function var eLe = document.getElementById (args.id) ؛ var allime = args.alltime ؛ var arr = [] ؛ var t = math.floor (Allime/(24*60*60)) ؛ var yt = Allime ٪ (24*60*60) ؛ var s = math.floor (yt/(60*60)) ؛ var ys = yt ٪ (60*60) ؛ var f = math.floor (ys/(60)) ؛ var yf = ys ٪ (60) ؛ var m = yf ؛ arr [0] = [t ، "Day"] ؛ arr [1] = [s ، "ساعة"] ؛ arr [2] = [f ، "Minute"] ؛ arr [3] = [m ، "الطرف الثاني"] ؛ var s = ce (arr ، 0) ؛ ele.innerhtml = s ؛ فار دونغ dong = setInterval (function () {alltime- = 1 ؛ if (Allime <= 0) {clearinterval (dong) ؛ ele.innerhtml = "<span> 0 </span> second" ؛ args.end () ؛} ell {t = math.floor (Allime/(24*60)) ؛ s = yt/(60*60) ؛ s = arr ، 0) ؛ وظيفة CE (ARR ، STA) {var i = sta ؛ if (i <arr.length) {if (arr [i] [0]! = 0) {var s = "" ؛ لـ (var j = i ؛ j <arr.length ؛ j ++) {s+= "<span>"+arr [j] [0]+"</span>"+arr [j] [1] ؛ } ؛ العودة s ؛ } آخر {return ce (arr ، i+1) ؛ } ؛ } ؛ } ؛ } ؛ } ؛ } ؛ } ؛ } ؛ // العد التنازلي نهاية // تأثير 1 // 86402 3602 62 TBDTIMECOUNTDOWN ({id: "A1" ، // يحتوي على حاوية العد التنازلية كل الوقت: 3 ، // الكليون ثواني النهاية: الدالة () {// نهاية العد التنازلية ، الوقت 0 هو الوظيفة المسمى // تنبيه ("نهايات العد التنازلي!) // effect 2 tbdtimeCountDown ({id: "A2" ، // يحتوي على حاوية العد التنازلي كل الوقت: 62 ، // Total Countdown Seconds End: function () {// countdown end ، time 0 هو الدالة المسمى} ،}) ؛ // effect 3 tbdtimeCountDown ({id: "A3" ، // يحتوي على حاوية العد التنازلي كل الوقت: 3602 ، // Total Countdown Seconds End: function () {// countdown end ، time 0 هو الدالة المسمى} ،}) ؛ // effect 4 tbdtimeCountDown ({id: "A4" ، // يحتوي على حاوية العد التنازلي كل الوقت: 86402 ،/Total Countdown Seconds End: function () {// countdown end ، time 0 هو الدالة المسمى} ،}) ؛ // effect 4 tbdtimeCountDown ({id: "A4" ، // يحتوي على حاوية العد التنازلي كل الوقت: 86402 ،/Total Countdown Seconds End: function () {// countdown end ، time 0 هو الدالة المسمى} ،}) ؛ // effect 4 tbdtimeCountDown ({id: "A4" ، // يحتوي على حاوية العد التنازلي كل الوقت: 86402 ،/Total Countdown Seconds End: function () {// countdown end ، time 0 هو الدالة المسمى} ،}) ؛ // effect 4 tbdtimeCountDown ({id: "A5" ، // يحتوي على حاوية العد التنازلي كل الوقت: 154789 ، // Total Countdown Seconds End: function () {// نهاية العد التنازلي ، الوقت 0 هو الدالة المسمى} ،}) ؛ </script> </html>2. العد التنازلي 2.html
<! doctype html> <html> <head> <meta charset = "utf-8"/> <title> العد التنازلي </title> <link rel = "stylesheet" href = "css/common.css" type = "text/css" charset = "utf-8"/> style = "text"> padding: 0 ؛} .dtime {margin: 10px ؛} .dtime span {color:#c30 ؛} </style> </head> <body> <div id = "a1" alltime = "3" Alltime = "48605"> </viv> <div id = "a5" alltime = "123456"> </div> </body> <script> function tbdtimeCountDown (args) {// countdown function var eLe = document.getElementById (args.id) ؛ var allime = number (ele.getAttribute (args.alltime)) ؛ var arr = [] ؛ var t = math.floor (Allime/(24*60*60)) ؛ var yt = Allime ٪ (24*60*60) ؛ var s = math.floor (yt/(60*60)) ؛ var ys = yt ٪ (60*60) ؛ var f = math.floor (ys/(60)) ؛ var yf = ys ٪ (60) ؛ var m = yf ؛ arr [0] = [t ، "Day"] ؛ arr [1] = [s ، "ساعة"] ؛ arr [2] = [f ، "Minute"] ؛ arr [3] = [m ، "الطرف الثاني"] ؛ var s = ce (arr ، 0) ؛ ele.innerhtml = s ؛ فار دونغ dong = setInterval (function () {alltime- = 1 ؛ ele.setAttribute (args.alltime ، Allime) ؛ if (All Time <= 0) {clearinterval (dong) ؛ ele.innerhtml = "<span> 0 </span> seconds" ؛ yt = 24*60) ؛ arr [3] = [M ، "الطرف الثاني"] ؛ وظيفة CE (ARR ، STA) {var i = sta ؛ if (i <arr.length) {if (arr [i] [0]! = 0) {var s = "" ؛ لـ (var j = i ؛ j <arr.length ؛ j ++) {s+= "<span>"+arr [j] [0]+"</span>"+arr [j] [1] ؛ } ؛ العودة s ؛ } آخر {return ce (arr ، i+1) ؛ } ؛ } ؛ } ؛ } ؛ } ؛ } ؛ } ؛ // countdown end // effect 1 // 86402 3602 62 TBDTIMECOUNTDOWN ({id: "a1" ، // يحتوي على حاوية العد التنازلي في كل الوقت: "Allime" ، // Total Countdown Seconds End: function () {// countdown end ، time 0 هو تنبيه الوظيفة المسمى ("سيتم تنفيذ نهاية العد التنازلي!") // effect 2 tbdtimeCountDown ({id: "A2" ، // يحتوي على حاوية العد التنازلي كل الوقت: "Allime" ، // Total Countdown Seconds End: Function () {// countdown End ، time 0 هو الدالة المسمى} ،}) ؛ // effect 3 tbdtimeCountDown ({id: "A3" ، // يحتوي على حاوية العد التنازلية كل الوقت: "Allime" ، // Total Countdown Seconds End: Function () {// countdown End ، time 0 هو الدالة المسمى} ،}) ؛ // effect 4 tbdtimeCountDown ({id: "A4" ، // يحتوي على حاوية العد التنازلي كل الوقت: "Allime" ، // Total Countdown Seconds End: Function () {// countdown End ، time 0 هو الدالة المسمى} ،}) ؛ // effect 4 tbdtimeCountDown ({id: "A5" ، // يحتوي على حاوية العد التنازلية كل الوقت: "Allime" ، // Total Countdown Seconds End: Function () {// countdown End ، time 0 هو الدالة المسمى} ،}) ؛ </script> </html>يمكنك الرجوع إلى الموضوع الخاص "ملخص وظيفة العد التنازلي JS" للدراسة المتعمقة.
ما سبق هو كل شيء عن هذا المقال ، وآمل أن يكون من المفيد للجميع تعلم برمجة JavaScript.