Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID


We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Can not generate a blank option on a drop down menu

pmoralespmorales Posts: 3Member
I have a script that generates the days of a month once you select a month and checks to see if the month is a leapyear once you select a year. I can't get the day drop down list to have a blank option on top of the 1 once a month or year has been selected. So lets say you select a date and then you decide to not enter a date you can't make the day dropdown menu blank because there is no blank option to choose. Can someone tell me how I can enter a blank option into my day dropdown menu?

Untitled Document



function GetDaysInMonth(iMonth, iYear)
var dPrevDate = new Date(iYear, iMonth, 0);
return dPrevDate.getDate();

var mylength
var myprevlength
var daycounter
var prevdaycounter
var TheYear
var TheDay
var TheMonth

function writedays()
var TheYear=document.all.Year.value
var TheDay=document.all.Day.value
var TheMonth=document.all.Month.value
var myoday=document.all.CD.value
if (TheDay!="")
if((TheMonth !=="" && TheYear!=="") || (TheMonth !==null && TheYear !==null))

mylength=GetDaysInMonth(TheMonth, TheYear)
var Daysarray=new Array(mylength)

if (document.all.Day.options.length>0)


Sign In or Register to comment.