selectable.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html>
  3. <head>
  4. <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />
  5. <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' />
  6. <script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script>
  7. <script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script>
  8. <script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script>
  9. <script type='text/javascript'>
  10. $(document).ready(function() {
  11. var date = new Date();
  12. var d = date.getDate();
  13. var m = date.getMonth();
  14. var y = date.getFullYear();
  15. var calendar = $('#calendar').fullCalendar({
  16. header: {
  17. left: 'prev,next today',
  18. center: 'title',
  19. right: 'month,agendaWeek,agendaDay'
  20. },
  21. selectable: true,
  22. selectHelper: true,
  23. select: function(start, end, allDay) {
  24. var title = prompt('Event Title:');
  25. if (title) {
  26. calendar.fullCalendar('renderEvent',
  27. {
  28. title: title,
  29. start: start,
  30. end: end,
  31. allDay: allDay
  32. },
  33. true // make the event "stick"
  34. );
  35. }
  36. calendar.fullCalendar('unselect');
  37. },
  38. editable: true,
  39. events: [
  40. {
  41. title: 'All Day Event',
  42. start: new Date(y, m, 1)
  43. },
  44. {
  45. title: 'Long Event',
  46. start: new Date(y, m, d-5),
  47. end: new Date(y, m, d-2)
  48. },
  49. {
  50. id: 999,
  51. title: 'Repeating Event',
  52. start: new Date(y, m, d-3, 16, 0),
  53. allDay: false
  54. },
  55. {
  56. id: 999,
  57. title: 'Repeating Event',
  58. start: new Date(y, m, d+4, 16, 0),
  59. allDay: false
  60. },
  61. {
  62. title: 'Meeting',
  63. start: new Date(y, m, d, 10, 30),
  64. allDay: false
  65. },
  66. {
  67. title: 'Lunch',
  68. start: new Date(y, m, d, 12, 0),
  69. end: new Date(y, m, d, 14, 0),
  70. allDay: false
  71. },
  72. {
  73. title: 'Birthday Party',
  74. start: new Date(y, m, d+1, 19, 0),
  75. end: new Date(y, m, d+1, 22, 30),
  76. allDay: false
  77. },
  78. {
  79. title: 'Click for Google',
  80. start: new Date(y, m, 28),
  81. end: new Date(y, m, 29),
  82. url: 'http://google.com/'
  83. }
  84. ]
  85. });
  86. });
  87. </script>
  88. <style type='text/css'>
  89. body {
  90. margin-top: 40px;
  91. text-align: center;
  92. font-size: 14px;
  93. font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  94. }
  95. #calendar {
  96. width: 900px;
  97. margin: 0 auto;
  98. }
  99. </style>
  100. </head>
  101. <body>
  102. <div id='calendar'></div>
  103. </body>
  104. </html>