Xcodeで、
カレンダーを作成しています。
日曜日始まりの土曜日までで1行のテーブルにしたいです。
できるところから書いているので間違いいっぱいあるかと思うのですが、
日曜日の背景を赤、文字を黒
土曜日の背景を青、文字を白
にするにはどうしたらよいのでしょうか。
色々と省略していますが、
なくてはならない情報があれば教えてください。
1コマずつ作成していマス。
html
1<h3 id="thismonth" >0年00月</h3>
css
1div#main table thead tr th.sun, 2div#main table thead tr th.sat { 3 background-color: #929292; 4} 5 6div#main table tbody tr td { 7 background-color: #fff; 8 text-align: left; 9 border: none; 10 border-left: 1px solid #E3E3DD; 11 border-top: 1px solid #E3E3DD; 12 padding: 0.3em; 13 vertical-align: top; 14} 15
javascript
1 2 3//テーブルヘッダー 4var html = ""; 5 6 7html += nowyear + '年' + nowmonth + '月; 8 9 10$("#thismonth").html(html); 11 12 13html = ""; 14 15 16html +='<thead><tr><th class="sun">日</th><th>月</th><th>火</th><th>水</th><th>木</th><th>金</th><th class="sat">土</th></tr></thead>'; 17 18 html +='<tbody>' 19 20 21 22 23//1日の曜日までの空欄 24 25var blank = now.getDay(); 26var count = 0; 27for(var i = 0 ; i < blank ; i++) { 28 29 30 if(count % 7 == 0) { 31 32 html +='<tr>'; 33 34 } 35 36 37 html +='<td></td>'; 38 39 count++; 40 41 42} 43 44 45 46 47 48//日にち 49 50for(var i = 1 ; i <= days ; i++) { 51 52 53if(count % 7 == 0) { 54 55html +='<tr>'; 56 57 58} 59 60count++; 61 62 63if(count % 7 == 0) { 64 65html +='</tr>'; 66 67week++; 68 69} 70 71 72} 73 74 75 76// 最後の日から土曜までの空欄 77 78while(count % 7 != 0) { 79 80 81html +='<td></td>'; 82 83count++; 84 85if(count % 7 == 0) { 86 87html +='</tr>'; 88 89week++; 90 91} 92 93 94}
宜しくお願いいたします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/11/17 04:43