Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ปฎิทิน ไม่สามารถรันบน Chome Firefox เป็นโค๊ดปฎิทิน ครับ แต่พอผมรันเก็บ Firefox , Google choome ได้ครับ



 

ปฎิทิน ไม่สามารถรันบน Chome Firefox เป็นโค๊ดปฎิทิน ครับ แต่พอผมรันเก็บ Firefox , Google choome ได้ครับ

 



Topic : 041575

Guest




เป็นโค๊ดปฎิทิน ครับ แต่พอผมรันเก็บ Firefox , Google choome ได้ครับ แต่ถ้าเป็น IE ได้ครับ พอมีวิธีที่ทำให้โค๊ดด้านล่างรันได้ ทั้ง Firefox , Google choome พอมีวิธีเปล่าครับ
Code (PHP)
<script language=JavaScript> 
<!-- Begin
var bg_color = "bgcolor=#dddddd";
var bg_color_head = "bgcolor=#444444"
var now = new Date();
var month_array = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
document.write("<form name=date_list><table "+ bg_color +"><tr style='font-family:MS Sans Serif;font-size:8pt;'><td style='font-family:MS Sans Serif;font-size:8pt;'>");
document.write("<select name=month onchange=change_month(this.options.selectedIndex)>");
for(i=0;i<month_array.length;i++)
{
 if (now.getMonth() != i)
 {document.write ("<option value="+i+">"+month_array[i]);}
 else
 {document.write ("<option value="+i+" selected>"+month_array[i]);}
}
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+543));}
 else
 {document.write("<option value="+i+" selected>"+(i+543));}
}
document.write("</select></td></tr><tr style='font-family:MS Sans Serif;font-size:8pt;'><td colspan=2><center>");
document.write("<table bgcolor=white border=0 cellspacing = 0 cellpading = 0 width=100%><tr style='font-family:MS Sans Serif;font-size:8pt;' "+ bg_color_head +" align=center>");
document.write("<td><font color=yellow>Mo</font></td><td><font color=pink>Tu</td><td><font color=#00ff66>We</td><td><font color=orange>Th</td><td><font color=#CCF2FF>Fr</td><td ><font color=violet>Sa</td><td ><font color=red>Su</td>");
document.write("</tr><tr style='font-family:MS Sans Serif;font-size:8pt;'>");
for(j=0;j<6;j++)
{
 for(i=0;i<7;i++)
 {
 document.write("<td style='font-family:MS Sans Serif;font-size:8pt;' 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 = "#ff3399";colum_name.style.color = "white";};
 colum_name.innerText = 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.innerText = "-";
 colum_name.style.backgroundColor ="";
 colum_name.style.color ="";
 }
}
}
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>





Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-04-15 22:02:58 By : boy View : 1175 Reply : 6
 

 

No. 1



โพสกระทู้ ( 318 )
บทความ ( 2 )



สถานะออฟไลน์
Facebook

.getYear() ต้อง +1900 หรือให้เปลี่ยน เป็น .getFullYear() ให้หมดจะได้ ปีปัจจุบันเป็น 2010 แล้วถ้าจะทำให้เป็นปีพ.ศ ต้อง +543 ครับ
สุดท้ายใน function set_cal() ให้เปลี่ยนจาก innerText เป็น innerHTML แค่นี้ก็คงจะไม่เกินความสามารถนะครับรันได้ทุกเบราเซอร์อยู่แล้ว
ขอให้ลองแก้โค้ดตามที่บอกเอาเองก่อนนะครับจะได้เก่งๆ






Date : 2010-04-17 04:23:15 By : chineji
 


 

No. 2



โพสกระทู้ ( 318 )
บทความ ( 2 )



สถานะออฟไลน์
Facebook

เบลอๆได้ยังคับ
Date : 2010-04-18 01:47:40 By : chineji
 

 

No. 3



โพสกระทู้ ( 96 )
บทความ ( 0 )



สถานะออฟไลน์


ไม่ได้อะครับ ผม getFullYear แล้วแสดงครับ แต่ไม่ได้ 1 นาทีก็หายครับ ส่วนที่พี่บอกให้ เปลี่ยนจาก innerText เป็น innerHTML ตรงไหนครับ และต้องขอขอบใจพี่มากๆน่ะครับ
Date : 2010-04-23 14:51:30 By : boy
 


 

No. 4



โพสกระทู้ ( 545 )
บทความ ( 0 )



สถานะออฟไลน์


ผม RUN ได้ทุกที่เลยนะครับ ไม่ต้องแก้ไรเลย
Date : 2010-04-26 09:13:20 By : kirisaki
 


 

No. 5

Guest


คุณ 88 เรียกใช้ยังไงครับ หรือ ก๊อฟ โค๊ดด้านบนวางที่ต้องการให้แสดง อ่ะครับ
ช่วยหน่อยครับ ของผมรันไม่ได้ รันใน IE ได้ แต่อย่างอื่นไม่ได้ครับ
Date : 2010-04-27 08:20:19 By : boy
 


 

No. 6



โพสกระทู้ ( 318 )
บทความ ( 2 )



สถานะออฟไลน์
Facebook

///นึกว่าได้ไปแล้วเสียอีกลองดูนะ

Code
<script language=JavaScript>
<!-- Begin
var bg_color = "bgcolor=#dddddd";
var bg_color_head = "bgcolor=#444444"
var now = new Date();
var month_array = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
document.write("<form name=date_list><table "+ bg_color +"><tr style='font-family:MS Sans Serif;font-size:8pt;'><td style='font-family:MS Sans Serif;font-size:8pt;'>");
document.write("<select name=month onchange=change_month(this.options.selectedIndex)>");
for(i=0;i<month_array.length;i++)
{
if (now.getMonth() != i)
{document.write ("<option value="+i+">"+month_array[i]);}
else
{document.write ("<option value="+i+" selected>"+month_array[i]);}
}
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.getFullYear() != i) //<<-----แก้ไข
{document.write("<option value="+i+">"+(i));}
else
{document.write("<option value="+i+" selected='selected'>"+(i));}
}
document.write("</select></td></tr><tr style='font-family:MS Sans Serif;font-size:8pt;'><td colspan=2><center>");
document.write("<table bgcolor=white border=0 cellspacing = 0 cellpading = 0 width=100%><tr style='font-family:MS Sans Serif;font-size:8pt;' "+ bg_color_head +" align=center>");
document.write("<td><font color=yellow>Mo</font></td><td><font color=pink>Tu</td><td><font color=#00ff66>We</td><td><font color=orange>Th</td><td><font color=#CCF2FF>Fr</td><td ><font color=violet>Sa</td><td ><font color=red>Su</td>");
document.write("</tr>");


for(j=0;j<6;j++)
{
document.write("<tr style='font-family:MS Sans Serif;font-size:8pt;'>");
for(i=0;i<7;i++)
{
document.write("<td style='font-family:MS Sans Serif;font-size:8pt;' 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.getFullYear(),show_date.getMonth(),1); //<<-----แก้ไข
begin_day_date = begin_day.getDay();
end_day = new Date (show_date.getFullYear(),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)
{
var now = new Date();
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.getFullYear() == now.getFullYear())) { //<<-----แก้ไข
colum_name.style.backgroundColor = "#ff3399";colum_name.style.color = "white";
}
colum_name.innerHTML = 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.innerHTML= "-";
colum_name.style.backgroundColor ="";
colum_name.style.color ="";
}
}
}
function change_month(sel_month)
{
show_date = new Date(show_date.getFullYear(),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>

Date : 2010-05-03 02:05:05 By : chineji
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ปฎิทิน ไม่สามารถรันบน Chome Firefox เป็นโค๊ดปฎิทิน ครับ แต่พอผมรันเก็บ Firefox , Google choome ได้ครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่