Write a JavaScript program to check whether the given year is leap year or not?

<html>
<head>
<title>Two textbox, when enter data in one textbox, it appears in second textbox</title>
<link rel="stylesheet" type="text/css" href="style.css">
/<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
               $("#leap1").click(function(){

var yr = $("#leap").val();

if (yr%4 == 0)
{
if (yr%100 == 0)
{
if (yr%400 != 0)
{
alert("Not Leap year");
return "false";
}
if (yr%400 == 0)
{
alert("Leap year");
return "true";
}
}
if (yr%100 != 0)
{
alert("Leap Year");
return "true";
}
}
if (yr%4 != 0)
{
alert("Not Leap");
return "false";
}

});



});


</script>


<body>

<h2>Check whether the given year  is leap year or not</h2>

    <div>

    <input type = "text" placeholder = "Enter Year to check Leap year or not?" id = "leap" size = "50">
    <button type= "button" id ="leap1">Check </button>
    </div>
</body>
</html>

Comments

  1. The check is actually pretty pitiful, obviously poorly photocopied. I'm going to play with them though. I have such a contempt for this slime and my only consolation is wasting as much of their time as I can.So check also http://www.howtly.com/write-a-check/ for more info about this topic.

    ReplyDelete

Post a Comment

Popular posts from this blog

Php Form validation with Error messages with Checking fields.

Simple calculator using JQuery and HTML..

how to customize dashboard in active admin gem in rails 4