selected year

Results 1 to 2 of 2

Thread: selected year

  1. #1
    Join Date
    Dec 1969

    Default selected year

    I have a dropdown box where I will be displaying financial years like 2002,2003,2004 and so on.<BR><BR>when a user selects a financial year<BR><BR>function disable(obj)<BR>{<BR>var csub=MyForm.FY; <BR>var yr = csub.options[csub.selectedIndex].value;<BR>if (yr==0)<BR>{<BR> alert("Please select Financial Year")<BR> obj.FY.focus()<BR> return false<BR><BR>}<BR>if (yr==2003)<BR>{<BR>shortyr="03"<BR>shortyr1="04"<B R>}<BR><BR>if (yr==2004)<BR>{<BR>shortyr="04"<BR>shortyr1="05"<B R>}<BR><BR>}<BR><BR>Here I am hardcoding the values..what I need is if selected year==2003 then<BR><BR>shortyr=03<BR>shortyr=04<BR><BR>anyhel p will be greatly appreciated

  2. #2
    Join Date
    Dec 1969

    Default RE: selected year

    Like this...<BR><BR>shortyr = yr.substring(2,4);<BR>shortyr1 = &#039;00&#039; + (parseInt(shortyr,10) + 1)<BR>shortyr1 = shortyr1.substring(shortyr1.length-2, shortyr1.length)<BR><BR>Gavin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts