Jump to content

combo box new option?


ki

Recommended Posts

okay im not really good with javascript but im attempting to make a birthday thing setup

 

function changeRegisterBirthday(e) {
    var bday = document.getElementById('registerBirthdayDay');
    var bmonth = document.getElementById('registerBirthdayMonth');
    var smonth = registerBirthdayMonth.options[registerBirthdayMonth.selectedIndex].value;

if(e == "1") {
  if ((registerBirthdayMonth.options[registerBirthdayMonth.selectedIndex].value == "6") || (smonth == "9") || (smonth == "4") || (smonth == "11")) {
    for (var i=0; i < 30; i++) {
       registerBirthdayDay.options[i] = new Option (i, i);
  }
}

 

Thats what I got (the rest of the code is cut off because its doing the same thing as the first option...)

 

But what my script is attempting to do is get the value of the selected option in the combobox of the months then go by the value of that to get their number then are sorted. What I would like to do is make it so it creates a combo box for the days of the month meaning like june = 6 = 30 so it would come out but im not getting how to do this, i even made a combo box on the page and still doesnt work.... Any ideas? Thanks for any help given.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.