[問題] javascript跑不出來

看板Ajax作者 (知足常樂)時間17年前 (2007/06/20 00:14), 編輯推噓1(101)
留言2則, 1人參與, 最新討論串1/1
<SCRIPT LANGUAGE="JavaScript"> function Calendar(Month,Year) { document.write("<FORM NAME='Cal'><TABLE BGCOLOR='lightskyblue'><TR><TD ALIGN=LEFT>"); document.write("<FONT COLOR='#0000BB' FACE='Arial' SIZE=+1>",names[Month]," ",Year,"</FONT></TD><TD WIDTH=50% ALIGN=RIGHT>"); document.write("</TD></TR><TR><TD ALIGN=CENTER COLSPAN=2>"); firstDay = new Date(Year,Month,1); startDay = firstDay.getDay(); if (((Year % 4 == 0) && (Year % 100 != 0)) || (Year % 400 == 0)) days[1] = 29; else days[1] = 28; document.write("<TABLE CALLSPACING=0 CELLPADDING=0 BORDER=1 BORDERCOLORDARK='#FFFFFF' BORDERCOLORLIGHT='#C0C0C0'><TR>"); for (i=0; i<7; i++) { document.write("<TD WIDTH=50 ALIGN=CENTER VALIGN=MIDDLE><FONT SIZE=-1 COLOR='#000000' FACE='ARIAL'><B>",dow[i],"</B></FONT></TD>"); } document.write("</TR><TR ALIGN=CENTER VALIGN=MIDDLE>"); var column = 0; var lastMonth = Month - 1; if (lastMonth == -1) lastMonth = 11; for (i=0; i<startDay; i++) { document.write("<TD WIDTH=50 HEIGHT=30><FONT SIZE=-1 COLOR='#808080' FACE='ARIAL'>",days[lastMonth]-startDay+i+1,"</FONT></TD>"); column++; } for (i=1; i<=days[Month]; i++) { if ((i == thisDay) && (Month == thisMonth) && (Year == thisYear)) //當天,特別註明 document.write("<TD WIDTH=50 HEIGHT=30 BGCOLOR='#FFFFFF' BORDERCOLORDARK='#000000' BORDERCOLORLIGHT='#C0C0C0'><FONT SIZE=-1 COLOR='#FF0000' FACE='ARIAL'>",i,"</FONT></TD>"); else document.write("<TD WIDTH=50 HEIGHT=30><FONT SIZE=-1 COLOR='#0000BB' FACE='ARIAL'>",i,"</FONT></TD>"); column++; if (column == 7) { document.write("</TR><TR ALIGN=CENTER VALIGN=MIDDLE>"); column = 0; } } document.write("</TR></TABLE>"); document.write("</FORM></TD></TR></TABLE>"); } function Skip(Direction) { if (Direction == '+') { if (month == 11) { Selected_Month = 0; Selected_Year=year+1; } else { Selected_Month=month+1; Selected_Year=year; } } else { if (month == 0) { Selected_Month = 11; Selected_Year=year-1; } else { Selected_Month=month-1; Selected_Year=year;} } Calendar(Selected_Month,Selected_Year); } function array(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) { this[0] = m0; this[1] = m1; this[2] = m2; this[3] = m3; this[4] = m4; this[5] = m5; this[6] = m6; this[7] = m7; this[8] = m8; this[9] = m9; this[10] = m10; this[11] = m11; } </SCRIPT> <P> <CENTER> <SCRIPT LANGUAGE="JavaScript"> var Selected_Month; var Selected_Year; var today = new Date(); var year = today.getYear(); var month = today.getMonth(); var names = new array("January","February","March","April","May","June","July","August","September","October","November","December"); var days = new array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); var dow = new array("Sun","Mon","Tue","Wed","Thu","Fri","Sat","","","","",""); var today = new Date(); var thisDay = today.getDate(); var thisMonth = today.getMonth(); var thisYear = today.getYear() ; document.write("<input type='button' value='上個月' onClick='Skip('-')'>"); document.write("<input type='button' value='下個月' onClick='Skip('+')'>"); Calendar(month,year); </SCRIPT> 我要按上個月、下個月,但是他似乎沒動作,請高手幫我看一下程式哪裡有問題 找了半天找不出來,謝謝大家^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.121.219.87

06/20 00:23, , 1F
最後面 onClick=\"Skip('-')\"
06/20 00:23, 1F

06/20 00:26, , 2F
這樣就可以按了..只是按下去有點怪怪的..等其他高手來補完
06/20 00:26, 2F
※ 編輯: ntouckcm 來自: 140.121.219.87 (06/20 00:46)
文章代碼(AID): #16U038oM (Ajax)
文章代碼(AID): #16U038oM (Ajax)