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 > มีโค้ด datepicker แต่ไม่รู้จะบันทึกลง mysql ยังไง ช่่วยแนะนำทีครับ หรือใครมีโค้ดที่มันเข้าใจง่ายกว่านี้บ้างไหมครับ งงมาก



 

มีโค้ด datepicker แต่ไม่รู้จะบันทึกลง mysql ยังไง ช่่วยแนะนำทีครับ หรือใครมีโค้ดที่มันเข้าใจง่ายกว่านี้บ้างไหมครับ งงมาก

 



Topic : 060182



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



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




Code (PHP)
if (navigator.appName == "Netscape") {
     document.captureEvents(Event.MOUSEDOWN);
}

var gl_calendar_path = "./";
var gl_calendar_dsep = "/";
var gl_calendar_today = "<font color=\"#D6AB29\"><strong>วันนี้ :</strong></font>";
var gl_calendar_meses = Array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
var gl_calendar_dias = Array("อา.","จ.","อ.","พ.","พฤ.","ศ.","ส.");
var gl_calendar_year_offset = +543; //ทดปี พศ=+543, คศ=+0

document.write('<link rel=\"stylesheet\" type=\"text/css\" href=\"' + gl_calendar_path + 'calendar.css\">');

var isIE = (navigator.appName == "Microsoft Internet Explorer") ? true: false;

function gcalendar() {
     this.name = "calendar"; // ชื่อ
     this.dateformat = "dd/mm/yyyy"; // ฟอร์แมตของวันที่
     this.day = 0;
     this.month = 0;
     this.year = 0;
     this.value = "";
     this.dayofweek = 0;
     this.calendar_visibility = "hidden";
     this.posLeft = -1;
     this.posTop = -1;
     this.main_shadow = false;
     this.month_shadow = false;
 
     this.daypos = 0;
     this.daylength = 0;
     this.monthpos = 0;
     this.monthlength = 0;
     this.yearpos = 0;
     this.yearlength = 0;
     this.prevday = 0;
     this.prevmonth = 0;
     this.prevyear = 0;
     this.today_day = 0;
     this.today_month = 0;
     this.today_year = 0;
     this.init_day = 0;
     this.init_month = 0;
     this.init_year = 0;
     this.initalized = false;
     this.calendar_visible = false;

     this.parse_dateformat = new Function("for(i=0;i < this.dateformat.length;i++){if(this.dateformat.charAt(i) == 'd'){this.daypos = i;this.daylength = 1;if(this.dateformat.charAt(i + 1) == 'd'){this.daylength = 2;i++;continue;}}if(this.dateformat.charAt(i) == 'm'){this.monthpos = i;this.monthlength = 1;if(this.dateformat.charAt(i + 1) == 'm'){this.monthlength = 2;i++;continue;}}if(this.dateformat.charAt(i) == 'y'){this.yearpos = i;this.yearlength = 1;if(this.dateformat.charAt(i + 1) == 'y'){this.yearlength = 2;i++;if(this.dateformat.charAt(i + 1) == 'y'){this.yearlength = 3;i++;if(this.dateformat.charAt(i + 1) == 'y'){this.yearlength = 4;i++;continue;}}}}}");
     this.setdate = set_date;
     this.set_value = set_value;
     this.date_move = date_move;
     this.display = display;
     this.expand = expand;
     this.compress = new Function('this.monthselector_compress(); document.getElementById("CALLYR_" + this.name).style.visibility = "hidden"; document.getElementById("CALLYR_" + this.name + "_SHADOW").style.visibility = "hidden"; this.yearswitch_show_hide(true); this.calendar_visible = false; this.showWindowedObjects(true); this.onCompress();');
	
     this.parse_date = parse_date;
     //คืนค่า: 0= อาทิตย์, 1= จันทร์
     this.get_dayofweek = new Function("day","month","year","var a = Math.floor((14 - month)/12); var y = year - a; var m = month + 12*a - 2; var d = (day + y + Math.floor(y/4) - Math.floor(y/100) + Math.floor(y/400) + Math.floor((31*m)/12)) % 7; return d;");
     this.update_properties = new Function("document.getElementById(this.name).value = this.value; document.getElementById(this.name + '_Year').value = this.day; document.getElementById(this.name + '_Month').value = this.month; document.getElementById(this.name + '_Day').value = this.year; this.dayofweek = this.get_dayofweek(this.day,this.month,this.year); this.onPropertiesUpdated(); this.draw();");
     this.graphic_setup = graphic_setup;
     this.draw = draw;
     this.textbox_key = textbox_key;
     this.yearswitch_show_hide = new Function("forced","var arrow_up = document.getElementById(this.name + '_arrow_up'); var arrow_dn = document.getElementById(this.name + '_arrow_dn'); if (arrow_up.style.visibility != 'hidden' || forced == true) { arrow_up.style.visibility = 'hidden'; arrow_dn.style.visibility = 'hidden'; } else { arrow_up.style.visibility = 'visible'; arrow_dn.style.visibility = 'visible'; }");
     this.getMyXY = new Function("var obj = document.getElementById(this.name); for(var sumTop = 0, sumLeft = 0; obj != document.body; sumTop += obj.offsetTop,sumLeft += obj.offsetLeft, obj = obj.offsetParent); this.posLeft = sumLeft; this.posTop = sumTop;");
     this.monthselector_expand = monthselector_expand;
     this.monthselector_compress = new Function ("document.getElementById('CALLYR_' + this.name + '_MESES').style.visibility = 'hidden'; document.getElementById('CALLYR_' + this.name + '_MESES_SHADOW').style.visibility = 'hidden';");
     this.showWindowedObjects = showWindowedObjects;

     this.onCreate = new Function("");
     this.onExpand = new Function("");
     this.onCompress = new Function("");
     this.onPropertiesUpdated = new Function("");
     this.onYearSwitchClick = new Function("");
     this.onMonthSwitchClick = new Function("");
     this.onValueChange = new Function("");
     this.onDayClick = new Function("");
}

function display() {
     this.parse_dateformat();
     document.write('<table style=\"border-collapse: collapse; border: 1px solid #000000;\" border=\"0\" width=\"95px\" cellpadding=\"0\" cellspacing=\"0\">');
     document.write('<tr>');
     document.write('<td align=\"right\" width=\"76%\"><input onKeyDown=\"' + this.name + '.textbox_key(event);\" size=\"11\" maxlength=\"10\" class=\"CALENDAR_TXTBOX\" onChange=\"' + this.name + '.parse_date();\" type=\"text\" name=\"' + this.name + '\" id=\"' + this.name + '\" value=\"' + this.value + '\">');
     document.write('<input type="hidden" id="' + this.name + '_Year" name="' + this.name + '_Year" value="">');
     document.write('<input type="hidden" id="' + this.name + '_Month" name="' + this.name + '_Month" value="">');
     document.write('<input type="hidden" id="' + this.name + '_Day" name="' + this.name + '_Day" value="">');
     document.write('</td>');
     document.write('<td align=\"left\" width=\"24%\">');
     var img = "<img onMouseDown=\"" + this.name + ".expand();\" style=\"cursor: hand;\" width=\"18\" height=\"18\" border=\"0\" src=\"" + gl_calendar_path + "calendar_images/calendar.png\" name=\"" + this.name + "_CMD\" id=\"" + this.name + "_CMD\">";
     document.write(img);
     document.write('</td></tr>');
     document.write('</table>');
     document.write('<div class=\"CALENDAR_DIV_CALLYR\" name=\"CALLYR_' + this.name + '\" id=\"CALLYR_' + this.name + '\"></div>');
     document.write('<div class=\"CALENDAR_DIV_CALLYR_SHADOW\" name=\"CALLYR_' + this.name + '_SHADOW\" id=\"CALLYR_' + this.name + '_SHADOW\"></div>');
     document.write('<div class=\"CALENDAR_DIV_MESES\" name=\"CALLYR_' + this.name + '_MESES\" id=\"CALLYR_' + this.name + '_MESES\"></div>');
     document.write('<div class=\"CALENDAR_DIV_MESES_SHADOW\" name=\"CALLYR_' + this.name + '_MESES_SHADOW\" id=\"CALLYR_' + this.name + '_MESES_SHADOW\"></div>');
     this.graphic_setup();
     this.onCreate();
}

function graphic_setup() {
     var ret = "";
     ret += "<table align='center' border='0' width='100%' cellpadding='0' cellspacing='0'>";
     ret += "<tr>";
     ret += "<td colspan='7'>";
     ret += "<table align='center' border='0' width='100%' cellpadding='0' cellspacing='0'>";
     ret += "<tr>";
     ret += "<td width='21' height='21' align='left' class='CALENDAR_BG_HEADER_MES_ANO'><a style='cursor: hand;' href=\"javascript: " + this.name + ".date_move('m',-1);\"><img width='21' height='21' border='0' src='" + gl_calendar_path + "calendar_images/calendar_prev_month.gif'></a></td>";
     ret += "<td height='21' onclick=\"\" class='CALENDAR_BG_HEADER_MES_ANO' align='right' id='" + this.name + "_MONTH_LAYER' name='" + this.name + "_MONTH_LAYER'>&nbsp;</td>";
     ret += "<td height='21' class='CALENDAR_BG_HEADER_MES_ANO' align='right' id='" + this.name + "_YEAR_LAYER' name='" + this.name + "_YEAR_LAYER'>&nbsp;</td>";
     ret += "<td height='21' width='12' class='CALENDAR_BG_HEADER_MES_ANO' align='right'><img id=\"" + this.name + "_arrow_up\" name=\"" + this.name + "_arrow_up\" onClick=\"javascript: " + this.name + ".onYearSwitchClick();" + this.name + ".date_move('y',1);\" style='visibility: hidden; cursor: hand;' width='12' height='12' border='0' src='" + gl_calendar_path + "calendar_images/calendar_section_up.gif'><br><img id=\"" + this.name + "_arrow_dn\" name=\"" + this.name + "_arrow_dn\" onClick=\"javascript: " + this.name + ".onYearSwitchClick(); " + this.name + ".date_move('y',-1);\" style='visibility: hidden; cursor: hand;' width='12' height='12' border='0' src='" + gl_calendar_path + "calendar_images/calendar_section_dn.gif'></td>";
     ret += "<td width='21' height='21' align='right' class='CALENDAR_BG_HEADER_MES_ANO'><a style='cursor: hand;' href=\"javascript: " + this.name + ".date_move('m',1);\"><img width='21' height='21' border='0' src='" + gl_calendar_path + "calendar_images/calendar_next_month.gif'></a></td>";
     ret += "</tr></table></td></tr>";
     ret += "<tr>";
     for(i=0;i < gl_calendar_dias.length;i++) {
          ret += "<td width='21' class='CALENDAR_BG_HEADER_DIAS_TEXT' align='center'>" + gl_calendar_dias[i] + "</td>";
     }
     ret += "</tr>";
     ret += "<tr>";
     ret += "<td colspan='7'>";
     ret += "<div id=\"CALLYR_" + this.name + "_MAIN\"></div>";
     ret += "</td>";
     ret += "<tr>";
     ret += "<tr>";
     ret += "<td height='18' colspan='7' class='CALENDAR_BOTTOM_TODAY' align='center' valign='middle' id='" + this.name + "_today' name='" + this.name + "_today'></td>";
     ret += "<tr>";
     ret += "</table>";
     document.getElementById("CALLYR_" + this.name).innerHTML = ret;
     var tmp = Array();
     var tmp_date = new Date();
     this.today_day = tmp_date.getDate();
     this.today_month = (tmp_date.getMonth() + 1);
     this.today_year = tmp_date.getFullYear();
     tmp[this.daypos] = (tmp_date.getDate().toString().length == 1) ? "0" + tmp_date.getDate().toString() : tmp_date.getDate().toString();
     tmp[this.monthpos] = ((tmp_date.getMonth() + 1).toString().length == 1) ? "0" + (tmp_date.getMonth() + 1) : (tmp_date.getMonth() + 1);
     tmp[this.yearpos] = tmp_date.getFullYear() + gl_calendar_year_offset;
     var tmp_show = "";
     var tmpdatesep = gl_calendar_dsep;
     for(var x=0;x < tmp.length;x++) {
          if (x == tmp.length - 1) { tmpdatesep = ""; }
          if (tmp[x] != "" && tmp[x] != null) { tmp_show += tmp[x] + tmpdatesep; }
     }
     tmp_show = gl_calendar_today + " <a href='javascript: " + this.name + ".set_value(" + tmp_date.getDate().toString() + "," + (tmp_date.getMonth() + 1).toString() + "," + tmp_date.getFullYear() + "); " + this.name + ".compress();' class='CALENDAR_BOTTOM_LINK_TODAY'>" + tmp_show + "</a>";
     document.getElementById(this.name + "_today").innerHTML = tmp_show;
     this.draw();
}

function draw() {
     if (this.calendar_visibility != "visible") { return; }
     if (this.prevday == this.day && this.prevmonth == this.month && this.prevyear == this.year) { return; }
     var ret = "";
     var lyr_month = document.getElementById(this.name + "_MONTH_LAYER");
     lyr_month.innerHTML = "<a href=\"javascript: " + this.name + ".monthselector_expand();\" class='CALENDAR_HEADER_LINK'>" + gl_calendar_meses[this.month - 1] + "</a>";
     var lyr_year = document.getElementById(this.name + "_YEAR_LAYER");
     var year_val=this.year+gl_calendar_year_offset;
     lyr_year.innerHTML = "<a class='CALENDAR_HEADER_LINK' href=\"javascript: " + this.name + ".yearswitch_show_hide();\">" + year_val.toString() + "</a>";
     ret += "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
     var intmonth = this.month;
     var intyear = this.year;
     var strmonth = intmonth.toString();
     var stryear = intyear.toString();
     var tmp_day = 0;
     var tmp_date = new Date(strmonth + '/1/' + stryear);
     var tmp_last_day = new Date(strmonth + '/0/' + stryear).getDate();
     var f = 0;
     var tmp_class1 = "";
     var tmp_class2 = "";
     var tmp_link = "";
     var init_day = this.get_dayofweek(1,intmonth,intyear);
     if (init_day != 0) {
          tmp_date = new Date(strmonth + '/0/' + stryear);
          var tmp = 0;
          for(i=1;i < init_day;i++) {
               tmp = tmp_date.getDate() - 1;
               tmp_date = new Date((tmp_date.getMonth() + 1).toString() + "/" + tmp.toString() + "/" + tmp_date.getFullYear().toString());
          }
     }
     ret += "<tr>";
     var tmp_next_year = 0;
     var tmp_next_month = 0;
     var tmp_prev_year = 0;
     var tmp_prev_month = 0;
     var tmp_show = "";
     var tmp_month = 0;
     var tmp_year = 0;
     tmp_next_year = intyear;
     tmp_prev_year = intyear;
     tmp_prev_month = intmonth - 1;
     tmp_next_month = intmonth + 1;
     if (tmp_prev_month == 0) { tmp_prev_month = 12; tmp_prev_year--; }
     if (tmp_next_month == 13) { tmp_next_month = 1; tmp_next_year++; }
     tmp_next_year = tmp_next_year.toString();
     tmp_prev_year = tmp_prev_year.toString();
     tmp_next_month = tmp_next_month.toString();
     tmp_prev_month = tmp_prev_month.toString();
     for(x=0;x < 42;x++) {
          if (f == 7) { f = 0; ret += "</tr><tr>"; } f = (f + 1) % 8;
          tmp_day = tmp_date.getDate();
          tmp_month = (tmp_date.getMonth() + 1);
          tmp_year = tmp_date.getFullYear();
          tmp_class1 = "CALENDAR_DIAS_LINK";
          tmp_class2 = "CALENDAR_DIAS_LINK_TD";
          tmp_link = "javascript: " + this.name + ".set_value(" + tmp_day.toString() + "," + strmonth + "," + stryear + "); " + this.name + ".compress(); " + this.name + ".onDayClick();";
          if ((tmp_month < intmonth || tmp_year < intyear) && tmp_day > 1)  {
               tmp_class1 = "CALENDAR_DIAS_OTRO_MES";
               tmp_link = "javascript: " + this.name + ".set_value(" + tmp_day.toString() + "," + tmp_prev_month + "," + tmp_prev_year + "); " + this.name + ".compress(); " + this.name + ".onDayClick();";
               tmp_nocalcular = 1;
          }
          if ((tmp_month > intmonth || tmp_year > intyear) && tmp_day < tmp_last_day - 7) {
               tmp_class1 = "CALENDAR_DIAS_OTRO_MES";
               tmp_link = "javascript: " + this.name + ".set_value(" + tmp_day.toString() + "," + tmp_next_month + "," + tmp_next_year + "); " + this.name + ".compress(); " + this.name + ".onDayClick();";
          }
          if (tmp_day == this.today_day && tmp_month == this.today_month && tmp_year == this.today_year) { tmp_class2 = "CALENDAR_DIAS_LINK_TD_TODAY"; tmp_class1 = "CALENDAR_DIAS_LINK_TODAY"; }
          if (tmp_day == this.day && tmp_month == this.month && tmp_year == this.year) { tmp_class2 = "CALENDAR_DIAS_LINK_TD_DIA_SELECCIONADO"; tmp_class1 = "CALENDAR_DIAS_LINK_DIA_SELECCIONADO"; }
          if (this.get_dayofweek(tmp_day,tmp_month,tmp_year) == 0) { tmp_class1 += "_SUN"; tmp_class2 += "_SUN"; }
          ret += "<td class='" + tmp_class2 + "' align='center'><a href=\"" + tmp_link + "\" class=" + tmp_class1 + ">" + tmp_day.toString() + "</a></td>";
          tmp_date = new Date(tmp_month.toString() + "/" + (tmp_day + 1).toString() + "/" + tmp_year.toString());
     }
     ret += "</tr>";
     ret += "<tr><td class='CALENDAR_DIAS_LINK_TD_SUN' height='11px'><td height='11px' colspan='6'></td></tr>";
     ret += "</table>";
     document.getElementById("CALLYR_" + this.name + "_MAIN").innerHTML = ret;
     this.prevday = this.day;
     this.prevmonth = intmonth;
     this.prevyear = intyear;
     ret = "<table align='center' border='0' width='70px' cellpadding='1' cellspacing='0'>";
     for(var y=0;y < gl_calendar_meses.length;y++) {
          ret += "<tr>";
          ret += "<td align=\"center\"><a class=\"CALENDAR_DIV_LINK\"  href=\"javascript: " + this.name + ".set_value(" + this.day + "," + (y + 1).toString() + "," + this.year + "); " + this.name + ".onMonthSwitchClick();" + this.name + ".monthselector_compress();\">" + gl_calendar_meses[y] + "</a></td>";
          ret += "</tr>";
     }
     ret += "</table>";
     var obj1 = document.getElementById("CALLYR_" + this.name + "_MESES");
     var obj2 = document.getElementById("CALLYR_" + this.name + "_MESES_SHADOW");
     obj1.innerHTML = ret;
}

function parse_date() {
     this.value = document.getElementById(this.name).value;
     var tmp_date2 = Date.parse(this.value);
     if (isNaN(tmp_date2)) {
          var tmp = Array();
          tmp[this.daypos] = this.init_day.toString();
          tmp[this.monthpos] = this.init_month.toString();
          tmp[this.yearpos] = this.init_year.toString();
          var sep = gl_calendar_dsep;
          this.value = '';
          for(var y=0;y < tmp.length;y++) {
               if (y == (tmp.length - 1)) {sep = "";}
               if (tmp[y] != '' && tmp[y] != null) {
                    this.value += tmp[y] + sep;
               }
          }
     }
     var tmp_day = this.value.substr(this.daypos,this.daylength);
     var tmp_month = this.value.substr(this.monthpos,this.monthlength);
     var tmp_year = this.value.substr(this.yearpos,this.yearlength);
     if (!isNaN(Math.floor(tmp_day))) { this.day = Math.floor(tmp_day); }
     if (!isNaN(Math.floor(tmp_month))) { this.month = Math.floor(tmp_month); }
     if (!isNaN(Math.floor(tmp_year))) { this.year = Math.floor(tmp_year); }
     this.date_move('d',0);
}

function set_date(day,month,year,cancelevent) {
     this.set_value(day,month,year-gl_calendar_year_offset,cancelevent)
}

function set_value(day,month,year,cancelevent) {
     this.day = Math.floor(day);
     this.month = Math.floor(month);
     year = Math.floor(year);
     this.year = (year < 200) ? (year + 1900) : year;
     if (this.initalized == false) {
          this.initalized = true; 
          this.init_day = (!isNaN(day)) ? day : new Date().getDate();
          this.init_month = (!isNaN(month)) ? month : new Date().getMonth() + 1;
          this.init_year = (!isNaN(year)) ? year : new Date().getFullYear();
     }
     var tmp_array = Array();
     var tmp_day = this.day.toString();
     var tmp_month = this.month.toString();
     var tmp_year= this.year+gl_calendar_year_offset;
     tmp_array[this.daypos] = (tmp_day.length < 2) ? '0' + tmp_day : tmp_day;
     tmp_array[this.monthpos] = (tmp_month.length < 2) ? '0' + tmp_month : tmp_month;
     tmp_array[this.yearpos] = tmp_year.toString();
     var ret = '';
     for(i=0;i < tmp_array.length;i++) {
          if (tmp_array[i] != '' && tmp_array[i] != null) {
               ret += tmp_array[i] + gl_calendar_dsep;
          }
     }
     ret += 'RP';
     ret = ret.replace('/RP', '');
     this.value = ret;
     this.update_properties();
     if(cancelevent != true) { this.onValueChange(); }
     document.getElementById(this.name).focus();
}

function date_move(part,cantidad) {
     switch (part) {
     case 'd': case 'D':
          this.day += cantidad;
          break;
     case 'm': case 'M':
          if (cantidad < 0 && this.month == 1) {
               this.month = 12;this.year--;
          } else {
               this.month += cantidad;
          }
          break;
     case 'y': case 'Y':
          this.year += cantidad;
          break;
     }
     if (this.day < 0) {
          var tmp = new Date(this.month.toString() + "/0/" + this.year.toString());
          this.year = tmp.getFullYear();
          this.month = (tmp.getMonth() + 1);
          this.day = (tmp.getDate() + this.day);
     }
     var tmp = new Date(this.month.toString() + "/" + this.day.toString() + "/" + this.year.toString());
     this.day = tmp.getDate();
     this.month = (tmp.getMonth() + 1);
     this.year = tmp.getFullYear();
     this.set_value(this.day,this.month,this.year);
}

function expand() {
     var obj_Calendar = document.getElementById("CALLYR_" + this.name);
     var obj_CalendarSH = document.getElementById("CALLYR_" + this.name + "_SHADOW");
     if (obj_Calendar.style.visibility != "visible") {
          if (this.posLeft == -1 && this.posTop == -1) { this.getMyXY(); }
          var clX = this.posLeft;
          var clY = this.posTop;
          if (isIE) {
               obj_Calendar.style.posLeft = clX;
               obj_CalendarSH.style.posLeft = clX + 3;
               obj_Calendar.style.posTop = clY + 20;
               obj_CalendarSH.style.posTop = clY + 28;
          } else {
               obj_Calendar.style.left = clX - 1;
               obj_CalendarSH.style.left = clX + 5;
               obj_Calendar.style.top = clY + 19;
               obj_CalendarSH.style.top = clY + 24;
          }
          this.showWindowedObjects(false);
          obj_Calendar.style.visibility = "visible";
          if (this.main_shadow == true) { obj_CalendarSH.style.visibility = "visible"; }
          this.calendar_visible = true;
     } else {
          this.compress();  
     }
     this.calendar_visibility = obj_Calendar.style.visibility;
     this.draw();
     this.onExpand();
}

function monthselector_expand() {
     var obj1 = document.getElementById("CALLYR_" + this.name + "_MESES");
     var obj2 = document.getElementById("CALLYR_" + this.name + "_MESES_SHADOW");
     if (this.posLeft == -1 && this.posTop == -1) { this.getMyXY(); }
     var clX = this.posLeft;
     var clY = this.posTop;
     obj1.style.height = 170;
     obj2.style.height = 170;
     obj1.style.width = 70;
     obj2.style.width = 70;
     if (isIE) {
          obj1.style.posLeft = clX + 30;
          obj2.style.posLeft = clX + 44;
          obj1.style.posTop = clY - 47;
          obj2.style.posTop = clY - 35;
     } else {
          obj1.style.left = clX + 30;
          obj2.style.left = clX + 44;
          obj1.style.top = clY - 47;
          obj2.style.top = clY - 33;
     }
     obj1.style.visibility = "visible";
     if (this.month_shadow == true) { obj2.style.visibility = "visible";}
}

function showWindowedObjects(show) {
     if (isIE) {
          var windowedObjectTags = new Array("SELECT", "OBJECT","APPLET","EMBED","IFRAME");
          var windowedObjects = new Array();
          var j=0;
          for (var i = 0; i < windowedObjectTags.length; i++) {
               var tmpTags = document.all.tags(windowedObjectTags[i]);
               if (tmpTags.length > 0) {
                    for (var k=0; k < tmpTags.length; k++) {
                         windowedObjects[j++] = tmpTags[k];
                    }
               }
          }
          for (var i = 0; i < windowedObjects.length; i++) {
               windowedObjects[i].visBackup = "";
               if (!show)
                    windowedObjects[i].visBackup = (windowedObjects[i].style.visibility == null) ? "visible" : windowedObjects[i].style.visibility;
               windowedObjects[i].style.visibility = (show) ? windowedObjects[i].visBackup : "hidden";
          }
     }
}

function textbox_key(evt) {
     var a = evt.keyCode;
     var tmp_expand = false;
     switch (a) {
     case 13:
          this.parse_date();
          this.expand();
          break;
     case 27:
          this.compress();
          break;
     case 40:
          if (this.calendar_visible == true) { this.date_move("d",7); } tmp_expand = true;
          break;
     case 38:
          if (this.calendar_visible == true) { this.date_move("d",-7); } tmp_expand = true;
          break;
     case 39:
          if (this.calendar_visible == true) { this.date_move("d",1); } tmp_expand = true;
          break;
     case 37:
          if (this.calendar_visible == true) { this.date_move("d",-1); } tmp_expand = true;
          break;
     }
     if (tmp_expand == true && this.calendar_visible != true) { this.expand(); }
}




Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-05-13 22:21:37 By : sakabuto View : 1528 Reply : 9
 

 

No. 1



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



สถานะออฟไลน์
Twitter Facebook Hi5 Blogger

Goto : AJAX กับการสร้างปฏิทินแบบ pickup






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-13 22:32:26 By : prach_kp
 


 

No. 2



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



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


Code (JavaScript)
<script type="text/javascript">
		var cal2 = new gcalendar();
		cal2.name = "cal2";
		cal2.dateformat = "dd/mm/yy";
		cal2.display();
		cal2.setdate( <?=date( "d" )?> , <?=date( "m" )?> , <?=( date( "Y" ) + 543 ) ?> , true ); //กำหนดวันที่วันนี้
		</script>


การเรียกใช้งาน แล้วมันลง textbox ยังไงครับ แล้วจะเอาลงฐานข้อมูลทำไงดีครับ ต้องมาแปลงค่าอีกใช่ไหมครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-13 22:34:52 By : sakabuto
 

 

No. 3



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



สถานะออฟไลน์
Twitter Facebook Hi5 Blogger

ลองที่ผมแนะนำหรือยังครับ ง่ายๆ นะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-13 22:55:35 By : prach_kp
 


 

No. 4



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



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


มันไม่โชว์ ในส่วนของ body นะครับ ก็ทำตามที่แนะนำแล้วนะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-13 23:31:15 By : sakabuto
 


 

No. 5



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



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


ไม่รู้เกี่ยวกับ

Code (JavaScript)
<!-- Start of JQuery -->
<link type="text/css" href="../css/ui-lightness/jquery-ui-1.8.2.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.2.custom.min.js"></script>
<!-- End of JQuery -->


ของผมแก้เป็น
Code (JavaScript)
<!-- Start of JQuery -->
<link type="text/css" href="../jquery-ui-1.8.2.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="../jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../jquery-ui-1.8.2.custom.min.js"></script>
<!-- End of JQuery -->

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-13 23:34:48 By : sakabuto
 


 

No. 6



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



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


ในส่วนของ body ผมก็งงว่ามันเรียกใช้ function ยังไง

Code (PHP)
<table>
<tr>
<td><div align="right"><span class="style11">วันที่</span></div></td>
<td>:</td>
<td><label>
<div align="left">
<input type="text" name="Key_Date" id="date" />
</div>
</label></td>
</tr>
</table>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-13 23:41:02 By : sakabuto
 


 

No. 7



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



สถานะออฟไลน์
Twitter Facebook Hi5 Blogger

ดาวน์โหลดไฟล์ไปไว้ตามที่บอกแล้วหรือยังครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-13 23:41:07 By : prach_kp
 


 

No. 8



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



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


ผมก็ทำตามนี้เลยนะครับ

<!-- ในส่วนของ head ต้องใส่ link ทั้ง 3 ไฟล์ เพื่อที่จะแสดงปฏิทิน-->
<!-- Start of JQuery -->
<link type="text/css" href="../css/ui-lightness/jquery-ui-1.8.2.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.2.custom.min.js"></script>
<!-- End of JQuery -->


<!-- ในส่วนของ head ต้องใส่ javascript ที่จะแสดงปฏิทิน-->
<script type="text/javascript">
$(document).ready(function(){

$('#date').datepicker({
showOn: 'button', buttonImage: '../images/calendar-blue.gif',
dateFormat: 'dd-mm-yy'
});

$('#date').datepicker('option', 'monthNames',
['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม']
);

$('#date').datepicker('option', 'dayNamesMin',
['อา', 'จ.', 'อ.', 'พ.', 'พฤ', 'ศ.', 'ส.']
);
</script>

<!-- ในส่วนของ body ที่จะแสดงปฏิทิน-->

<table>
<tr>
<td><div align="right"><span class="style11">วันที่</span></div></td>
<td>:</td>
<td><label>
<div align="left">
<input type="text" name="Key_Date" id="date" />
</div>
</label></td>
</tr>
</table>
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-13 23:46:04 By : sakabuto
 


 

No. 9



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



สถานะออฟไลน์
Twitter Facebook Hi5 Blogger

Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>:: test ajax date ::</title>

<!-- Start of JQuery -->
<!-- <link type="text/css" href="../css/ui-darkness/jquery-ui-1.8.2.custom.css" rel="Stylesheet" /> -->
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.2.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.2.custom.min.js"></script>
<!-- End of JQuery -->

<script type="text/javascript">
$(document).ready(function(){
	
	$('#date').datepicker({
		showOn: 'button', buttonImage: 'images/calendar-blue.gif', 
		dateFormat: 'dd-mm-yy'
		});
	
	$('#date').datepicker('option', 'monthNames',
		['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม']
		);

	$('#date').datepicker('option', 'dayNamesMin',
		['อา', 'จ.', 'อ.', 'พ.', 'พฤ', 'ศ.', 'ส.']
		);
});

</script>

<style type="text/css">
<!--
.style11 {color: #003399; font-size: 12px; }
-->
</style>
</head>

<body bgcolor="#F0F0F0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<div align="center">

	<form id="form1" name="form1" method="post" action="view.php">

		<table>
		<tr>
		<td><div align="right"><span class="style11">วันที่</span></div></td>
		<td>:</td>
		<td><label>
		<div align="left">
		<input type="text" name="Key_Date" id="date" />
		</div>
		</label></td>
		</tr>
		</table>
<input type="submit"> <input type="reset">
	</form>
</div>
</body>
</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-14 00:13:20 By : prach_kp
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : มีโค้ด datepicker แต่ไม่รู้จะบันทึกลง mysql ยังไง ช่่วยแนะนำทีครับ หรือใครมีโค้ดที่มันเข้าใจง่ายกว่านี้บ้างไหมครับ งงมาก
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 02
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 อัตราราคา คลิกที่นี่