Leap Year varification

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cybermom
    New Member
    • Jun 2007
    • 1

    Leap Year varification

    Hi another newbie here

    I am trying to get the message: The you entered is a leap year, but it does not happen, what did I do wrong with this script?

    <html>
    <HEAD>

    <SCRIPT LANGUAGE="JavaS cript">
    <!--hide from old browsers

    function test(){
    if ((parseInt(docu ment.getElement ById("year")) % 4 == 0)&&
    ((parseInt(docu ment.getElement ById("year")) % 100 != 0)||
    ((parseInt(docu ment.getElement ById("year")) % 400 == 0))))
    alert("The year you entered is a Leap Year")
    else {
    alert("The year you entered is a standard year");
    }
    }
    //stop hiding from old browsers-->
    </script>

    </HEAD>
    <BODY>
    <form name="result">
    <INPUT type="text" id="year"><p>
    <INPUT type= "submit" name="button" value="Check for Leap Year" onClick="test() "><p>
    </form>
    </body>
    </html>
  • DeMan
    Top Contributor
    • Nov 2006
    • 1799

    #2
    Hi cybermom,

    Welcome to TSDN. I'm sure you will find a wealth of knowledge here. I will redirect this question to the JavaScript forum, where the experts will be better able to assist with your question.

    In future, you can find the various forums by selecting them from the drop down menus on the blue bar near the top of the screen.

    I hope the experts in the js forum can be of assistance!

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5388

      #3
      hi ...

      have a look at the following thread ...



      kind regards

      Comment

      Working...