ปฏิทินอย่างง่ายด้วย php และ css
เขียนเมื่อ 13 ปีก่อน โดย Ninenik Narkdeephp ปฏิทิน calendar css
คำสั่ง การ กำหนด รูปแบบ ตัวอย่าง เทคนิค ลูกเล่น การประยุกต์ การใช้งาน เกี่ยวกับ php ปฏิทิน calendar css
ไปที่
Copy
CSS Code
<style type="text/css"> #calendar_css { background-color:#F0F0F0; border-style:solid; border-width:0px; border-right-width:0px; border-bottom-width:0px; border-color:#cccccc; } #calendar_css td{ text-align:center; font:11px tahoma; width:2%; height:18px; } #calendar_css thead{ text-align:center; font:11px tahoma; width:2%; height:18px; background-color:#333333; color:#FFFFFF; } #calendar_css .current{ text-align:center; font:11px tahoma; width:2%; height:18px; background-color:#FF0000; color:#FFFFFF; } col.holidayCol{ background-color:#FDDFE4; color:#FF0000; } td.monthTitle{ background-color:#666666; text-align:center; font:11px bold tahoma; } </style>
PHP Code
<?php $day_now=array("Sun"=>"1","Mon"=>"2","Tue"=>"3","Wed"=>"4","Thu"=>"5","Fri"=>"6","Sat"=>"7"); $first_day=date("D",mktime(0,0,1,intval(date("m")),1,date("Y"))); $start_td=$day_now[$first_day]-1; $num_day=date("t"); $num_day2=($num_day+$start_td); $num_day3=(7*ceil($num_day2/7)); ?> <table id="calendar_css" width="175" border="0" cellspacing="0" cellpadding="0"> <colgroup> <col class="holidayCol" /> <col span="5" /> <col class="holidayCol" /> </colgroup> <thead> <tr> <td colspan="7" class="monthTitle"> <?=date("M-Y")?> </td> </tr> <tr> <td>อา </td> <td>จ </td> <td>อ </td> <td>พ </td> <td>พฤ </td> <td>ศ </td> <td>ส </td> </tr> </thead> <?php for($i=1;$i <=$num_day3;$i++){ ?> <?php if($i%7==1){ ?> <tr> <?php } ?> <td <?=(date("j")==$i-$start_td)?"class=\"current\"":""?>> <?=($i-$start_td>=1 && $i-$start_td <=$num_day)?$i-$start_td:" "?> </td> <?php if($i%7==0){ ?> </tr> <?php } ?> <?php } ?> </table>
ตัวอย่าง
Dec-2009 | ||||||
อา | จ | อ | พ | พฤ | ศ | ส |
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
กด Like หรือ Share เป็นกำลังใจ ให้มีบทความใหม่ๆ เรื่อยๆ น่ะครับ

เนื้อหาที่เกี่ยวข้อง
-
กำลังอ่านเนื้อหานี้อยู่25 Sep2008ปฏิทินอย่างง่ายด้วย php และ css อ่าน 50,680
CSS Code <style type="text/css"> #calendar_css { background-color:#F0F0F
-
09 Nov2008สร้างปฏิทินด้วย php และ css โดยไม่ต้องใฃ้ตาราง อ่าน 33,602
อัพเดทเนื้อหาใหม่ปี 2020 ใช้รูปแบบการกำหนด css โดยใช้ รูปแบบ flex layout
URL สำหรับอ้างอิง
Top
Copy
ขอบคุณทุกการสนับสนุน
![]()