인터넷정보

매월 마지막 날자 구하기

알 수 없는 사용자 2007. 10. 18. 13:42
http://oxtag.com/html/ex/ex/ex3.html

  1. <SCRIPT LANGUAGE="JavaScript">
  2. <!--
  3. function hoho() {
  4. Sdate = new Date()
  5. Syy = ff.yy.options[ff.yy.selectedIndex].value ;
  6. Smm = parseInt( ff.mm.options[ff.mm.selectedIndex].value ) + 1 ;
  7. Sdate.setFullYear(Syy,Smm,0) ;
  8. Endcount = Sdate.getDate() ;
  9. // 지정된 실렉트박스의 옵션 갯수를 변경할 경우...
  10. ff.dd.options.length = Endcount
  11. for(i=0 ; i < Endcount ; i++) {
  12.     ii = i + 1
  13.     ff.dd.options[i].text = ii
  14.     ff.dd.options[i].value = ii
  15. }
  16. }
  17. //-->
  18. </SCRIPT>
  19. <center>
  20. <br>
  21. 매월 마지막 날짜 구하기 <br><br>
  22. <FORM METHOD=POST ACTION="" name='ff'>
  23. <SELECT NAME="yy" onChange = 'hoho()'>
  24. <option value='2003'> 2003 </option>
  25. <option value='2004'> 2004 </option>
  26. <option value='2005'> 2005 </option>
  27. <option value='2006'> 2006 </option>
  28. <option value='2007'> 2007 </option>
  29. </SELECT>
  30. <SELECT NAME="mm" onChange = 'hoho()'>
  31. <option value='0'> 1 </option>
  32. <option value='1'> 2 </option>
  33. <option value='2'> 3 </option>
  34. <option value='3'> 4 </option>
  35. <option value='4'> 5 </option>
  36. <option value='5'> 6 </option>
  37. <option value='6'> 7 </option>
  38. <option value='7'> 8 </option>
  39. <option value='8'> 9 </option>
  40. <option value='9'> 10 </option>
  41. <option value='10'> 11 </option>
  42. <option value='11'> 12 </option>
  43. </SELECT>
  44. <SELECT NAME="dd" onChange = 'hoho()'>
  45. <option value='1'>1</option>
  46. <option value='2'>2</option>
  47. <option value='3'>3</option>
  48. <option value='4'>4</option>
  49. <option value='5'>5</option>
  50. <option value='6'>6</option>
  51. <option value='7'>7</option>
  52. <option value='8'>8</option>
  53. <option value='9'>9</option>
  54. <option value='10'>10</option>
  55. <option value='11'>11</option>
  56. <option value='12'>12</option>
  57. <option value='13'>13</option>
  58. <option value='14'>14</option>
  59. <option value='15'>15</option>
  60. <option value='16'>16</option>
  61. <option value='17'>17</option>
  62. <option value='18'>18</option>
  63. <option value='19'>19</option>
  64. <option value='20'>20</option>
  65. <option value='21'>21</option>
  66. <option value='22'>22</option>
  67. <option value='23'>23</option>
  68. <option value='24'>24</option>
  69. <option value='25'>25</option>
  70. <option value='26'>26</option>
  71. <option value='27'>27</option>
  72. <option value='28'>28</option>
  73. <option value='29'>29</option>
  74. <option value='30'>30</option>
  75. <option value='31'>31</option>
  76. </SELECT>
  77. </FORM>
반응형