2014-11-23 62 views
0

所以我(再次)开始网页设计,并决定尝试我的运气,为我父亲的业务一个非常复杂的网站。他教棒球,所以我想制作一个日历。我终于明白了我如何使用HTML表格,所以现在我想把日期放到日历中,但不想删除表格,因为它需要很长时间才能完美。将日期放入使用Javascript和HTML的日历表

所以我想这样做的方式是给第一个星期天设置为1的所有单元格赋值,依此类推,直到我打到42,但不知道是否可以赋值除表单域/对象以外的任何其他内容。我尝试使用div,它在我目前的技能水平上让我感到非常困惑和不可能,因此我不希望这些div符合我的要求。我计划让日历显示基于日历管理视图的开口。我只是不能通过它来逻辑我的方式,所以你们如何做到这一点。我希望日常价值观能够出现在适当的位置,我可以自己做。我只需要最初的月份代码,然后我可以从那里开始。

这里的的jsfiddle链接: http://jsfiddle.net/rccrf/m9kny41m/

HTML

<!DOCTYPE html> 
<body> 
<div id="JMBody"> 
<div id="masterBody"> 
<div id="fixed"> 
<!--Heading Table--> 
    <header id="Title"> 
    <table id="tTable"> 
     <tr id="topRow"> 
      <td id="leftCell"><image id="ball" src="ball.png" /></td> 
      <td id="JMB" class="middleCell"><span id="JMBaseball">John Martin Baseball</span><br /><span id="home">Schedule</span></td> 
      <td id="rightCell" rowspan="3"><image id="john" src="John4.png"></td> 
     </tr> 
     <tr id="bottomRow"> 
      <td id="bBat" colspan="2"><img id="bat" src="bat2.png" /></td> 
     </tr> 
    </table> 
    </header> 
<!--Navigation Bar--> 
    <nav id="navBar"> 
     <table id="navi"> 
      <tr id="links"> 
       <td id="link3"><a href="JMHome.html">Home</a></td> 
       <td id="link1"><a href="JMProHis.html">Professional<br />History</a></td> 
       <td id="link2"><a href="JMPhilosophy.html">Philosophy</a></td> 
       <td id="link5"><a href="JMLessons.html">Schedule<br />Lessons</a></td> 
       <td id="link6"><a href="JMDirections.html">Driving<br />Directions</a></td> 
       <td id="link7"><a href="JMContact.html">Contact Me</a></td> 
      </tr> 
     </table> 
    </nav> 
</div> 
<!--Main Body of the site--> 
<div id="mBody"> 
<!-----------------------------------------------------------------> 
<!----------------Month View 1-------------------------------------> 
<!-----------------------------------------------------------------> 
<div class="monthBG" id="monthBG1"> 
    <table class="monthViewMain1" id="monthView1"> 
     <tr><!--Month Name Row--> 
      <td class="monthName" id="monthName1" colspan=7>November</td> 
     </tr> 
      <tr><!--Days of the Week Row--> 
       <td class="dotw1" id="sun"><b>Sunday</b></td> 
       <td class="dotw1" id="mon"><b>Monday</b></td> 
       <td class="dotw1" id="tue"><b>Tuesday</b></td> 
       <td class="dotw1" id="wed"><b>Wednesday</b></td> 
       <td class="dotw1" id="thu"><b>Thursday</b></td> 
       <td class="dotw1" id="fri"><b>Friday</b></td> 
       <td class="dotw1" id="sat"><b>Saturday</b></td> 
      </tr> 
      <tr class="weekRow" id="firstWeek1"> 
       <td class="firstWeekDayCellStart" id="sun1-1" placeholder="1"></td> 
       <td class="firstWeekDayCell" id="mon2-1" placeholder="2"></td> 
       <td class="firstWeekDayCell" id="tue3-1" placeholder="3"></td> 
       <td class="firstWeekDayCell" id="wed4-1" placeholder="4"></td> 
       <td class="firstWeekDayCell" id="thu5-1" placeholder="5"></td> 
       <td class="firstWeekDayCell" id="fri6-1" placeholder="6"></td> 
       <td class="firstWeekDayCellEnd" id="sat7-1" placeholder="7"></td> 
      </tr> 
      <tr class="weekRow" id="secondWeek1"> 
       <td class="weekDayCellStart" id="sun8-1" placeholder="1"></td> 
       <td class="weekDayCell" id="mon9-1" placeholder="2"></td> 
       <td class="weekDayCell" id="tue10-1" placeholder="3"></td> 
       <td class="weekDayCell" id="wed11-1" placeholder="4"></td> 
       <td class="weekDayCell" id="thu12-1" placeholder="5"></td> 
       <td class="weekDayCell" id="fri13-1" placeholder="6"></td> 
       <td class="weekDayCellEnd" id="sat14-1" placeholder="7"></td> 
      </tr> 
      <tr class="weekRow" id="thirdWeek1"> 
       <td class="weekDayCellStart" id="sun15-1" placeholder="1"></td> 
       <td class="weekDayCell" id="mon16-1" placeholder="2"></td> 
       <td class="weekDayCell" id="tue17-1" placeholder="3"></td> 
       <td class="weekDayCell" id="wed18-1" placeholder="4"></td> 
       <td class="weekDayCell" id="thu19-1" placeholder="5"></td> 
       <td class="weekDayCell" id="fri20-1" placeholder="6"></td> 
       <td class="weekDayCellEnd" id="sat21-1" placeholder="7"></td> 
      </tr> 
      <tr class="weekRow" id="fourthWeek1"> 
       <td class="weekDayCellStart" id="sun22-1" placeholder="1"></td> 
       <td class="weekDayCell" id="mon23-1" placeholder="2"></td> 
       <td class="weekDayCell" id="tue24-1" placeholder="3"></td> 
       <td class="weekDayCell" id="wed25-1" placeholder="4"></td> 
       <td class="weekDayCell" id="thu26-1" placeholder="5"></td> 
       <td class="weekDayCell" id="fri27-1" placeholder="6"></td> 
       <td class="weekDayCellEnd" id="sat28-1" placeholder="7"></td> 
      </tr> 
      <tr class="weekRow" id="fifthWeek1"> 
       <td class="weekDayCellStart" id="sun29-1" placeholder="1"></td> 
       <td class="weekDayCell" id="mon30-1" placeholder="2"></td> 
       <td class="weekDayCell" id="tue31-1" placeholder="3"></td> 
       <td class="weekDayCell" id="wed32-1" placeholder="4"></td> 
       <td class="weekDayCell" id="thu33-1" placeholder="5"></td> 
       <td class="weekDayCell" id="fri34-1" placeholder="6"></td> 
       <td class="weekDayCellEnd" id="sat35-1" placeholder="7"></td> 
      </tr> 
      <tr class="weekRow" id="sixthWeek1"> 
       <td class="weekDayCellLastSun" id="sun36-1" placeholder="1"></td> 
       <td class="lastWeekDayCell" id="mon37-1" placeholder="2"></td> 
       <td class="lastWeekDayCell" id="tue38-1" placeholder="3"></td> 
       <td class="lastWeekDayCell" id="wed39-1" placeholder="4"></td> 
       <td class="lastWeekDayCell" id="thu40-1" placeholder="5"></td> 
       <td class="lastWeekDayCell" id="fri41-1" placeholder="6"></td> 
       <td class="weekDayCellLastSat" id="sat42-1" placeholder="7"></td> 
      </tr> 
    </table> 
</div> 
</div> 
</div> 

<!-- Footer (also universal) --> 
    <footer id="legal"> 
     <a href="Disclaimer.html" id="aDisclaimer"> <span id="Disclaimer">Disclaimer</a>!!! </span><span> &copy <b>2014 RCCRF: Function</b> </span> 
    </footer> 
</div> 
</body> 
</html> 
+0

我强烈建议FullCalendar(http://fullcalendar.io/),可能配合使用带有一个框架,允许您执行声明性数据绑定,如Knockout(http://knockoutjs.com/)或Angular(https://angularjs.org/)。尽可能使用现有的图书馆,让其他人为你重担,而不是重新发明轮子。项目祝你好运。 – 2015-07-03 12:38:48

回答