JavaScript에서 Onclick오류 (Onclick Error in JavaScript) #21477
-
달력을 만들고 있습니다. 왼쪽 버튼을 클릭했을 때 저번 달로 이동 되고(보여지는) If you click the left button, it moves to the last month (as shown).
하지만 작동이 되지 않습니다ㅠㅠ But it doesn’t work.ᅲᅲ
혹시 몰라 전체코드를 첨부하겠습니다. alsgpwns/-HTML-CSS-JS-Make-a-calendar[HTML+CSS+JS] Make a calendar. Contribute to alsgpwns/-HTML-CSS-JS-Make-a-calendar development by creating an account on GitHub. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hello @alsgpwns, welcome to the GitHub Support Community! Since you’re incrementing and decrementing numbers, I would recommend using the Here is the updated code (see the IF statements at the top of each function):
If you want to reset the month when you get to the end, you can add an ELSE statement, like the one below.
This’ll also let you increment or decrement other variables, such as the year. |
Beta Was this translation helpful? Give feedback.
-
Hi :slight_smile:
|
Beta Was this translation helpful? Give feedback.
-
You’re welcome. Yes, initially, clicking the buttons did not update the HTML (at least with the provided code). Because of that, you couldn’t see any changes. |
Beta Was this translation helpful? Give feedback.
-
Thank you. |
Beta Was this translation helpful? Give feedback.
Hello @alsgpwns, welcome to the GitHub Support Community!
Since you’re incrementing and decrementing numbers, I would recommend using the
--
and++
operators. This way the changes made tomm
will be stored temporarily in memory and allow you to move forward or backward.Here is the updated code (see the IF statements at the top of each function):