Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

javascript Javascript Write an event handler so that when the user clicks the Check Year button, a function executes. This function should get a four

javascript

Javascript


Write an event handler so that when the user clicks the Check Year button, a function executes. This function should get a four digit year from the user and print out to the webpage whether or not the year is a leap year.


The first step is to validate the user input. This is done by checking to make sure the user enters a year larger than or equal to 1582. If the year is less, you should print an error message to the page.


Otherwise, you need to determine if the year the user entered is a leap year. A year is a leap year if it is divisible by four, unless it is also divisible by 100 but not divisible by 400. Then print to the page whether the year is a leap year or not.

image text in transcribed
Enter a year later than 1582 and we will tell you if it is leap year Enter a year later than 1582 and we will tell you if it is leap year Enter your year: Enter your year: 1400 is invalid 1900 is not a leap year Enter a year later than 1582 and we will tell you if it is leap year Enter a year later than 1582 and we will tell you if it is leap year Enter your year- Enter your year: 2003 is not a leap year 2000 is a leap year. Enter a year later than 1582 and we will tell you if it is leap year Enter your year: 2004 is a leap year

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions