Discuz Thai

 ลืมรหัสผ่าน
 สมัครสมาชิก

ข้อตกลงการใช้งานกระดานข่าวดิสคัสไทย DiscuzThai Agreement (English Version) ประกาศดิสคัสไทย - ทำเนียบดิสคัสภาษาไทย

Discuz! X3.5 Thai R20231001 Rev.8 (NEW) [วิดีโอช่วยสอน] อัปเกรด Discuz! X3.4 เป็น X3.5 Discord ของ Discuz! Thai Community อย่างเป็นทางการ

Discuz! X3.4 Thai R20220811 (REV.75) สิ้นสุดการสนับสนุน Discuz! X3.4 ภาษาไทยตั้งแต่วันนี้เป็นต้นไป (ขอแนะนำให้อัปเกรดเป็น X3.5 แทน)

ค้นหา
แท็กยอดนิยม: ดิสคัสภาษาไทย Discuz Thai
ดู: 5751|ตอบกลับ: 19

[X1.5] สคริป เค้าท์ดาวน์ สู่วันปีใหม่! {อัพเดตอันใหม่}

  [คัดลอกลิงก์]
mafia10th โพสต์ 2010-12-2 17:33:47 |โหมดอ่าน
แก้ไขครั้งสุดท้ายโดย mafia10th เมื่อ 2010-12-9 15:11

แก้ไขครั้งสุดท้ายโดย mafia10th เมื่อ 2010-12-9 12:28
  1. ตัวอย่าง : http://vongola-th.net
คัดลอกไปที่คลิปบอร์ด
**เอาไปใส่ได้ทุกที่ครับ!
  1. <center><script language="JavaScript">
  2. TargetDate = "12/31/2010 00:00 AM";
  3. BackColor = "#CCCC99";
  4. ForeColor = "black";
  5. CountActive = true;
  6. CountStepper = -1;
  7. LeadingZero = true;
  8. DisplayFormat = "อีกแค่ %%D%% วัน, %%H%% ชั่วโมง, %%M%% นาที, %%S%% วินาที  ก็ปีใหม่แล้ว!";
  9. FinishMessage = "Happy New Year 2011!! สวัสดีปีใหม่ 2554";


  10. function calcage(secs, num1, num2) {
  11.   s = ((Math.floor(secs/num1))%num2).toString();
  12.   if (LeadingZero && s.length < 2)
  13.     s = "0" + s;
  14.   return "<b>" + s + "</b>";
  15. }

  16. function CountBack(secs) {
  17.   if (secs < 0) {
  18.     document.getElementById("cntdwn").innerHTML = FinishMessage;
  19.     return;
  20.   }
  21.   DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
  22.   DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
  23.   DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
  24.   DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));

  25.   document.getElementById("cntdwn").innerHTML = DisplayStr;
  26.   if (CountActive)
  27.     setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod);
  28. }

  29. function putspan(backcolor, forecolor) {
  30. document.write("<span id='cntdwn' style='background-color:" + backcolor +
  31.                 "; color:" + forecolor + "'></span>");
  32. }

  33. if (typeof(BackColor)=="undefined")
  34.   BackColor = "white";
  35. if (typeof(ForeColor)=="undefined")
  36.   ForeColor= "black";
  37. if (typeof(TargetDate)=="undefined")
  38.   TargetDate = "12/31/2020 5:00 AM";
  39. if (typeof(DisplayFormat)=="undefined")
  40.   DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
  41. if (typeof(CountActive)=="undefined")
  42.   CountActive = true;
  43. if (typeof(FinishMessage)=="undefined")
  44.   FinishMessage = "";
  45. if (typeof(CountStepper)!="number")
  46.   CountStepper = -1;
  47. if (typeof(LeadingZero)=="undefined")
  48.   LeadingZero = true;


  49. CountStepper = Math.ceil(CountStepper);
  50. if (CountStepper == 0)
  51.   CountActive = false;
  52. var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
  53. putspan(BackColor, ForeColor);
  54. var dthen = new Date(TargetDate);
  55. var dnow = new Date();
  56. if(CountStepper>0)
  57.   ddiff = new Date(dnow-dthen);
  58. else
  59.   ddiff = new Date(dthen-dnow);
  60. gsecs = Math.floor(ddiff.valueOf()/1000);
  61. CountBack(gsecs);

  62. </script></center>
คัดลอกไปที่คลิปบอร์ด

คะแนน

จำนวนผู้เข้าร่วม 1จิตพิศัย +1 ย่อ เหตุผล
trafalgar + 1

ดูบันทึกคะแนน

por201502 โพสต์ 2010-12-3 17:41:52
ขอบคุงครับ
kaiaoo โพสต์ 2010-12-3 21:28:06
ขอบคุณๆๆๆๆ
groufie โพสต์ 2010-12-4 08:47:02
แจ่มครับ ขอบคุณมาก
trafalgar โพสต์ 2010-12-4 15:43:20
อยากเห็ฌนตัวอย่างก่อน
•Anime• โพสต์ 2010-12-6 19:47:31
เอาไปประยุกษ์ ได้ทุกวันเลยนะเนี่ย
 เจ้าของ| mafia10th โพสต์ 2010-12-9 12:34:11
อัพเดตตัส เค้าท์ดาวน์ตัวใหม่ครับ ไฉไล กว่าเดิม
hackerth โพสต์ 2010-12-9 18:47:07
แก้ไขครั้งสุดท้ายโดย hackerth เมื่อ 2010-12-9 18:47
  1. <HTML>
  2. <title> Count Down 2011 </title>
  3. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
  4. <BODY>
  5. <div style="text-align:center;margin-bottom:10px;padding:10px;font:12px/1.5 Tahoma,Helvetica,mingliu,sans-serif;">

  6. <?php
  7. date_default_timezone_set("asia/bangkok");
  8. $time = date("m/d/Y h:i:s A");
  9. ?>

  10. <script language="JavaScript">
  11. TargetDate = "1/1/2011 00:00 AM";       
  12. SetDate = ("<?= $time ?>");
  13. ForeColor = "#666666";
  14. CountActive = true;
  15. CountStepper = -1;
  16. LeadingZero = true;
  17. DisplayFormat = "<font color=#669900> เค้าท์ดาวน์ </font> :  วันปีใหม่ 2011 เหลืออีก :  <font color=#669900> %%D%%</font> วัน<font color=#669900> %%H%%</font> ชั่วโมง<font color=#669900> %%M%%</font> นาที<font color=#669900> %%S%% </font>วินาที !  ";
  18. FinishMessage = "<font color=#669900>Happy New Year 2011 !</font>";


  19. function calcage(secs, num1, num2) {
  20.   s = ((Math.floor(secs/num1))%num2).toString();
  21.   if (LeadingZero && s.length < 2)
  22.     s = "0" + s;
  23.   return "<b>" + s + "</b>";
  24. }

  25. function CountBack(secs) {
  26.   if (secs < 0) {
  27.     document.getElementById("cntdwn").innerHTML = FinishMessage;
  28.     return;
  29.   }
  30.   DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
  31.   DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
  32.   DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
  33.   DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));

  34.   document.getElementById("cntdwn").innerHTML = DisplayStr;
  35.   if (CountActive)
  36.     setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod);
  37. }

  38. function putspan(backcolor, forecolor) {
  39. document.write("<span id='cntdwn' style='background-color:" + backcolor +
  40.                 "; color:" + forecolor + "'></span>");
  41. }

  42. if (typeof(BackColor)=="undefined")
  43.   BackColor = "white";
  44. if (typeof(ForeColor)=="undefined")
  45.   ForeColor= "black";
  46. if (typeof(TargetDate)=="undefined")
  47.   TargetDate = "12/31/2020 5:00 AM";
  48. if (typeof(DisplayFormat)=="undefined")
  49.   DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
  50. if (typeof(CountActive)=="undefined")
  51.   CountActive = true;
  52. if (typeof(FinishMessage)=="undefined")
  53.   FinishMessage = "";
  54. if (typeof(CountStepper)!="number")
  55.   CountStepper = -1;
  56. if (typeof(LeadingZero)=="undefined")
  57.   LeadingZero = true;


  58. CountStepper = Math.ceil(CountStepper);
  59. if (CountStepper == 0)
  60.   CountActive = false;
  61. var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
  62. putspan(BackColor, ForeColor);
  63. var dthen = new Date(TargetDate);
  64. var dnow = new Date(SetDate);
  65. if(CountStepper>0)
  66.   ddiff = new Date(dnow-dthen);
  67. else
  68.   ddiff = new Date(dthen-dnow);
  69. gsecs = Math.floor(ddiff.valueOf()/1000);
  70. CountBack(gsecs);

  71. </script>
  72. </div>

  73. </BODY>
  74. </HTML>
คัดลอกไปที่คลิปบอร์ด
ของผมเป็น PHP ดึงเวลาจาก Server นะครับบางคนนาฬิกาไม่ตรงเพราะ Java script มันจะดึงจากเครื่องแค่อะนนี้ผม fix ให้กำหนดเวลาของ server [เป็น PHP นะครับ Iframe ดึงเข้าไปใช้เอาครับ หรือใครจะทำเป็น DIY มาแจกก็เต็มที่ครับ >,.<]
pongpen โพสต์ 2010-12-10 00:50:38
ขอบคุณมากๆครับ
แต่ของคุณ hackerth ผมลองมันแสดงเป็น Nanวัน  Nanชั่วโมง  Nanนาที  Nanวินาที อะครับมันไม่โผล่ตัวเลข
rocketeer โพสต์ 2010-12-15 11:32:16
เยี่ยมครับเอาไปลองแล้ว
  1. http://ideagood.net/rocketeercafe/forum.php
คัดลอกไปที่คลิปบอร์ด
ขออภัย! คุณไม่ได้รับสิทธิ์ในการดำเนินการในส่วนนี้ กรุณาเลือกอย่างใดอย่างหนึ่ง ลงชื่อเข้าใช้ | สมัครสมาชิก

รายละเอียดเครดิต

รายชื่อผู้กระทำผิด|Archiver|ดิสคัส ไทย Follow us: Become a fan on facebook. Follow us on Twitter.

GMT+7, 2024-4-24 16:24

Powered by Discuz! X3.4, Rev.66

Copyright © 2001-2021 Tencent Cloud. Licensed

ตอบกระทู้ ขึ้นไปด้านบน ไปที่หน้ารายการกระทู้