Wrox Programmer Forums
|
BOOK: Beginning JavaScript
This is the forum to discuss the Wrox book Beginning JavaScript by Paul Wilton; ISBN: 9780764544057
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 23rd, 2005, 03:53 AM
Authorized User
 
Join Date: Aug 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Regarding Date valadations

Hi ,

  i need a help in javascript and i have an text box and user will enter date in YYMM format please send the valadations in YYMM format. Please help me...i am new to

 
Old August 30th, 2005, 12:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Hi it would help u.

Code:
<HTML>
<HEAD>
<script>
  function validd(elem)
  {
    var Ret=0;
      var t = new String;
    t = elem.value;

    if(t.length < 4)
        Ret = 0;
    else
        {
            if(t.substr(0,2) > 0)
            {
                if(t.substr(2,2) > 0 & t.substr(2,2) <= 12)
                    Ret = 1;
                else
                    Ret = 0;
            }
            else
                Ret = 0;
        }

    alert(Ret)
    //return false;
  }

</script>
</HEAD>
<BODY>

<P><INPUT id=text1 maxLength=4 name=text1><INPUT id=button1 type=button value=Button name=button1 onclick="validd(text1);"></P>

</BODY>
</HTML>
Always:),
Hovik Melkomian.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Images from Start Date thru Date istcomnet Classic ASP Basics 2 May 23rd, 2008 07:12 AM
copy date values between date controls Alcapone Javascript How-To 1 April 13th, 2006 03:13 AM
How to give Date format while entering date Subuana Beginning VB 6 4 March 17th, 2006 07:25 AM
DTS Import ( Date string to Date field) gfowajuh SQL Server 2000 1 September 30th, 2003 06:28 AM
Convert String Date to Date for a SQL Query tdaustin Classic ASP Basics 4 July 7th, 2003 06:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.