If else using date

Discussion in 'JavaScript' started by dweekley, Feb 12, 2011.

  1. #1
    I am attempting ue this script, and beleive I have an issue with how I have the date formatted. Any assit would be appreciated.

    David

    <script type="text/javascript">
    function vmoc()
    {
    with (document.forms[0])
    {
    var stat = VM_Date_Returned.value;
    {

    if (stat = 1/1/1999)

    {
    VM_OC.value = "Open";
    }
    else
    {
    VM_OC.value = "Closed";
    }
    }
    }
    }
    </script>
     
    dweekley, Feb 12, 2011 IP
  2. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #2
    At a glance:
    
    if (stat = 1/1/1999)
    
    Code (markup):
    should be:
    
    if (stat == '1/1/1999')
    
    Code (markup):
     
    rainborick, Feb 12, 2011 IP
  3. dweekley

    dweekley Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That did it.

    Thanks
     
    dweekley, Feb 12, 2011 IP