javaScript ใน javascript คือว่าผมมีปัญหา มัน error document.write document.getElementById
//code ให้ไปถ้าเอาไปลองมันจะแปลกๆหน่อยนะครับเพราะไม่มี plug mysql
connect();
setDatabase("mstWeb");
$sql =select("*","mst_calendar","");
while($result = mysql_fetch_array($sql)){
echo $result[calendar_date];
$description[] = $result[calendar_description];
list($year, $month, $day) = split('[/.-]', $result[calendar_date]);
$year = (int)$year;
$month = (int)$month;
$day = (int)$day;
$name[$year][$month][$day] = $result[calendar_name];
echo "<input type=\"hidden\" value = \"$result[calendar_name]\" id = \"$result[calendar_date]\">";
echo "<input type=\"hidden\" value = \"$result[calendar_description]\" id = \"$result[calendar_date]\">";
}
disconnect();
?>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var now = new Date();
var month_array = new Array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
document.write("<form name=date_list><table bgcolor= \"#ffffff\" width =100% height = 500 border = 0><tr><td height = 20 >");
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);}
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 height = 100%><tr bgcolor=gray align=center>");
document.write("<td height = 20><font color=black>Monday</font></td><td><font color=black>Tuesday</td><td><font color=black>Wednesday</td><td><font color=black>Thursday</td><td><font color=black>Friday</td><td ><font color=black>Satuday</td><td ><font color=black>Sunday</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+" style =\"border:1px solid #b5b5b5;\" width = 90 height = 90 onmouseover=\"\"></td>");
}
document.write("</tr>");
}
document.write("</table>");
document.write("</center></form></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);
colum_name.style.backgroundColor ="#ffffff";
if ((now.getDate() == c)&&(show_date.getMonth() == now.getMonth())&&(show_date.getYear() == now.getYear())) {colum_name.style.backgroundColor = "blue";colum_name.style.color = "black";};
//colum_name.innerText = c ;
//colum_name.innerText = show_date.getMonth();
//colum_name.innerText = show_date.getYear();
if(c<10){
c = "0"+c;
}
m = show_date.getMonth()+1;
if(m<10){
m = "0"+m;
}
d =show_date.getYear()+"-"+m+"-"+c;
//dd = d+document.getElementById(d).value;
try{
colum_name.innerHTML = "<div onmouseover=\"\">"+c+"</div>";
colum_name.innerHTML += "<div style=\"visibility:visible;\"><table border = 1 width = 100><tr><td>"+document.getElementById(d).value+"</td></tr></table></div>";
}
catch(err){
}
//colum_name.innerText = d;
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 ="#f5f5f5";
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>
Date :
1 ต.ค. 2551 16:13:41
By :
terngjar
document.getElementById('xxx').style.visibility = 'visible'; // visible or hidden
เปลี่ยจาก :visible เป็น = 'visible' ครับ
http://gunner.freetzi.com
Date :
1 ต.ค. 2551 16:56:45
By :
เอี่ยว
Load balance : Server 00