- 締切済み
javascript で undefinedと表示されます
全ての変数、配列に alert(typeof variable); を試しましたが undefinedが見つかりません。 function a{ var lastdayArray = new Array ('','31','28','31','30','31','30','31','31','30','31','30','31'); var weekArray = new Array ('日','月','火','水','木','金','土'); var a = new Date(); var b = new Date(); var mymonth = a.getMonth()+1; var nextmonth =mymonth +1 ; var myyear = a.getYear()+1; var today = a.getDate(); var maxbox = 36; var sday = a.setDate(1); var nday = b.setDate(1); var nmonth = b.setMonth(mymonth); var nwday = b.getDay(); var fwk = a.getDay(); var nfday = 6 - nwday; var fline = 6 - fwk; var nextlsday = lastdayArray[mymonth]; var lsbox = (fwk + lastdayArray[mymonth]) +1; var monthArray = new Array(mymonth,nextmonth); var monthflg = new Array(fwk,nfday); var nextflg = new Array(fline,nwday); var s_no0 = 1; var s_no1 = 1; //数値代入変数 var s_no2 = 1; var s_no3 = 0; var s_no4 = 0; var s_no5 = 0; var s_no6 = 0; var s_no7 = 0; var s_no8 = 0; var schedule_no = new Array(s_no0,s_no1,s_no2,s_no3,s_no4,s_no5,s_no6,s_no7,s_no8); var s_str0 = 'a'; var s_str1 = 'a'; //文字列代入変数 var s_str2 = 'a'; var s_str3 = 'a'; var s_str4 = 'a'; var s_str5 = 'aa'; var s_str6 = 'a'; var s_str7 = 'a'; var s_str8 = 'a'; var schedule_str = new Array(s_str0,s_str1,s_str2,s_str3,s_str4,s_str5,s_str6,s_str7,s_str8); for(var x = 0; x < 2; x++){ daycount = 0; document.write(monthArray[x] + '月の予定'); if(nmonth == 12){nmonth = 0;} document.write('<table width="73%" height="337" border="1" cellpadding="1" cellspacing="1">'); //曜日出力 document.write('<tr>'); for(var l = 0 ; l <= 6; l ++){ if(l == 0){ weekArray[l] = (weekArray[l].fontcolor('#ff1493').fontsize(4)); } else if(l == 6){ weekArray[l] = (weekArray[l].fontcolor('#87ceeb').fontsize(4)); } document.write('<td>' + weekArray[l] +'</td>');} document.write('</tr>'); //曜日を判定しテーブル出力 document.write('<tr>'); //空ボックス出力 if((monthflg[x]) != 6 ){ for(var k = 0; k < (monthflg[x]); k++){ document.write('<td>' + ' ' +'</td>'); } } if((monthflg[x]) == 0){ for(var y = 0; y < 6 ; y++){ document.write('<td>' + ' ' +'</td>'); } if((schedule_no[y]) === daycount){ daycount ++; document.write('<td>' + daycount + schedule_str[y] +'</td>'); } else { daycount ++; document.write('<td>' + daycount +'</td>'); } } else{ //空ボックスの数~土曜日まで出力 for(var m =0 ; m <= nextflg[x]; m++){ if((schedule_no[m]) === daycount){ daycount ++; document.write('<td>' + daycount + schedule_str[m] +'</td>'); } else { daycount ++; document.write('<td>' + daycount +'</td>'); } } } document.write('</tr>'); //行出力 for(var i =0 ; i < 4; i++){ document.write('<tr>'); //列出力 for(var j =0 ; j < 7; j++){ if(daycount < lastdayArray[monthArray[x]]){ daycount ++; document.write('<td>' + daycount +'</td>'); } else{ document.write('<td>' + ' ' +'</td>'); } } document.write('</tr>'); } //最終行出力 if(daycount < lastdayArray[monthArray[x]]){ document.write('<tr>'); for(var p =0 ; p < 7 ; p++){ if(daycount < lastdayArray[monthArray[x]]){ if((schedule_no[p]) === daycount){ daycount ++; document.write('<td>' + daycount + schedule_str[p] +'</td>'); } else { daycount ++; document.write('<td>' + daycount +'</td>'); } } else{ document.write('<td>' + ' ' +'</td>'); } } document.write('</tr>'); } document.write('</table>'); } }
- みんなの回答 (1)
- 専門家の回答
みんなの回答
- STICKY2006
- ベストアンサー率29% (1536/5269)