Leap Year
This script function will validate the given year for leap year.
Features
The javascript function will return true if the passed argument is a leap year else returns false.
Just copy the code in to your page and use it.
Preview
Downloads
Javascript <!-- Script by hscripts.com --> <script type="text/javascript"> function checkleapyear(datea) {datea = parseInt(datea);if(datea%4 == 0) {if(datea%100 != 0) {return true; }else {if(datea%400 == 0)return true; elsereturn false;}} return false; } function isLeapYear() {var df = document.sd.yv.value;if(df!= "" && parseInt(df)){var res = checkleapyear(df);if(res) {document.sd.val.style.color = "green";document.sd.val.value = df+" is a leap year";} else{ document.sd.val.style.color = "#9a235d"; document.sd.val.value = df+" is not a leap year"; document.sd.val.value = df+" is not a leap year";}}else {alert("Enter a proper value"); } return false; } function isInteger(s) { var i;s = s.toString();for (i = 0; i < s.length; i++){var c = s.charAt(i);if (isNaN(c)) { alert("Given value is not a number");return false;}}return true; } </script> <form name=sd method=post action="" onsubmit="return isLeapYear()"> Enter a year [ ex: 2020 ] - <input name=yv type=text onKeyup="isInteger(this.value)"><input type=submit value=go><br> <input type=text name=val size=30 style="background-color:white; border:0px; margin:0px; color: #9a235d;" readonly> </form> <!-- Script by hscripts.com -->
Release Date - 5-2-2005 Get free version without ©copyright link for just $5/ -
For customization of this script or any script development, mail to support@hscripts.com
Usage
Just copy the code and use it for free.
License
The javascript (misspelled as java script) is given under GPL License.
i.e. Free use for those who use it as it is.
Free, if your modification does not remove our copyright information and links.
Detailed License information can be found here .
You can purchase the script if your requirements does not meet GPL License terms.
Related Scripts