แจก Code JavaScript (ปฏิทิน) นะจะ
LSVคลังสมองออนไลน์ "ปีที่21"
เมษายน 20, 2024, 03:37:10 AM *
ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
 
   หน้าแรก   ช่วยเหลือ เข้าสู่ระบบ สมัครสมาชิก  
หน้า: [1]   ลงล่าง
  พิมพ์  
ผู้เขียน หัวข้อ: แจก Code JavaScript (ปฏิทิน) นะจะ  (อ่าน 27572 ครั้ง)
Gun
member
*

คะแนน3
ออฟไลน์ ออฟไลน์

กระทู้: 19


... เพื่อนแห่งโลกไอที ...


« เมื่อ: กุมภาพันธ์ 23, 2007, 04:42:50 PM »

หากต้องการให้แสดงปฏิทินไว้ที่ไหนก็นำ CODE ด้านล่างไปไว้ในส่วนของ <body> นะจะ

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var now = new Date();
var month_array = new Array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
document.write("<form name=date_list><table bgcolor=silver><tr><td>");
document.write("<select name=month onchange=change_month(this.options.select edIndex)>");
for(i=0;i<month_array.length;i++)
{
 if (now.getMonth() != i)
 {document.write ("<option value="+i+">"+month_array);}
 else
 {document.write ("<option value="+i+" selected>"+month_array);}

}
document.write("</select>");
document.write("</td><td>");
document.write ("<select name=year onchange=change_year(this.options[this.options.selectedIndex])>");
for(i=1950;i<3000;i++)
{
 if (now.getYear() != i)
 {document.write("<option value="+i+">"+i);}
 else
 {document.write("<option value="+i+" selected>"+i);}
}
document.write("</select></td></tr><tr><td colspan=2><center>");

document.write("<table bgcolor=white border=0 cellspacing = 0 cellpading = 0 width=100%><tr bgcolor=gray align=center>");
document.write("<td><font color=black>จ</font></td><td><font color=black>อ</td><td><font color=black>พ</td><td><font color=black>พฤ</td><td><font color=black>ศ</td><td ><font color=black>ส</td><td ><font color=black>อ</td>");
document.write("</tr><tr>");
for(j=0;j<6;j++)
{
 for(i=0;i<7;i++)
 {
   document.write("<td align=center id=d"+i+"r"+j+"></td>")
 }
 document.write("</tr>");
}

document.write("</table>");

document.write("</center></from></td></tr></table>");

var show_date = new Date();

function set_cal(show_date)
{
begin_day = new Date (show_date.getYear(),show_date.getMonth(),1);
begin_day_date = begin_day.getDay();
end_day = new Date (show_date.getYear(),show_date.getMonth()+1,1);
count_day = (end_day - begin_day)/1000/60/60/24;
input_table(begin_day_date,count_day);
}
set_cal(show_date);

function input_table(begin,count)
{
init();
j=0;
if (begin!=0){i=begin-1;}else{i=6}
for (c=1;c<count+1;c++)
{
 colum_name = eval("d"+i+"r"+j);
 if ((now.getDate() == c)&&(show_date.getMonth() == now.getMonth())&&(show_date.getYear() == now.getYear())) {colum_name.style.backgroundColor = "blue";colum_name.style.co lor = "white";};
 colum_name.innerTex t =  c;
 i++;
 if (i==7){i=0;j++;}
}
}

function init()
{
for(j=0;j<6;j++)
{
 for(i=0;i<7;i++)
 {
 colum_name = eval("d"+i+"r"+j);
 colum_name.innerTex t =  "-";
 colum_name.style.ba ckgroundColor ="";
 colum_name.style.co lor ="";
 }
}
}

function change_month(sel_month)
{
show_date = new Date(show_date.getYear(),sel_month,1);
set_cal(show_date);
}

function change_year(sel_year)
{
sel_year = sel_year.value;
show_date = new Date(sel_year,show_date.getMonth(),1);
set_cal(show_date);
}
//  End -->
</script>
Embarrassed


บันทึกการเข้า

................... ................... .....

winai4u-LSV team
.กลุ่มผู้มีน้ำใจงาม.
member
*

คะแนน673
ออฟไลน์ ออฟไลน์

กระทู้: 3025



« ตอบ #1 เมื่อ: กุมภาพันธ์ 23, 2007, 05:14:52 PM »

Very thank you. ครับ  Smiley   Cheesy
บันทึกการเข้า
saksith
member
*

คะแนน5
ออฟไลน์ ออฟไลน์

กระทู้: 374


Tom_3027@hotmail.com
อีเมล์
« ตอบ #2 เมื่อ: กุมภาพันธ์ 23, 2007, 05:42:40 PM »

คืออะไรครับ Sad
บันทึกการเข้า
peera-500 ♥
วีไอพี
member
***

คะแนน116
ออฟไลน์ ออฟไลน์

กระทู้: 1329


ไม่ชอบคนโกง เอารัดเอาเปรียบ รักความยุติธรรม


อีเมล์
« ตอบ #3 เมื่อ: กุมภาพันธ์ 23, 2007, 06:18:04 PM »

แบบคนที่จะมี Homepage เอง เอาsource code ไปใส่ พอท่านไปเยี่ยมชมเว็บเค้า มันจะเเสดงรูป นาฬิกา ออกมา
บันทึกการเข้า
หน้า: [1]   ขึ้นบน
  พิมพ์  
 
กระโดดไป:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC2 | SMF © 2001-2006, Lewis Media

lsv2555Please follow the new website at https://www.pohchae.com

Valid CSS!