Try this:

<script>

function checkYear() {
        var frm = document.forms[0];

        if (parseInt(frm.YearFrom[frm.YearFrom.selectedIndex].value) >
                parseInt(frm.YearTo[frm.YearTo.selectedIndex].value)) {
                alert("Your From Date must be less than your To Date.");
        }
}

</script>

-----Original Message-----
From: Jerry Staple [mailto:[EMAIL PROTECTED]]
Sent: July 23, 2001 8:56 AM
To: CF-Talk
Subject: JavaScript Function


Hi,
Could anyone give me advice on the following function?

Ive got 2 Select boxes with Years as the value for each,so that the user
can pick dates from to etc.

  ie From <select name="YearFrom"> 1999 up to 2030
      to     <select name="YearTo">1999 up to 2030

what i require is a function  (Onsubmit) that makes sure that the year
to is not less than the year from,throwing up an alert box.


Many Thanks in Advance


Jerry Staple

Web Applications Developer
BizNet Solutions
133 - 137 Lisburn Rd
Belfast
BT9 7AG

Tel: +44 (0)28 9022 3224
Fax: +44 (0)28 9022 3223
www.biznet-solutions.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to