chriscloyd Posted December 29, 2006 Share Posted December 29, 2006 i have a form in php where people do there bdays so say like they choose february i want it to make it drop down the box with only 28 characters can any one help me with this part im not a noob at php i just dont know how to do this Quote Link to comment Share on other sites More sharing options...
emehrkay Posted December 29, 2006 Share Posted December 29, 2006 try this function. add to your select field onchange = "updateDropDown();" and put that select box in its own field or div or something with an unique id.let me know if it works or not[code]function updateDropDown(){ var days = new Object(); days['Jan'] = 30; days['Feb'] = 28; var month = document.getElementById('month field').value; for(keyVar in days){ if(keyVar == month){ dayCount = days[keyVar]; continue; } } list = '<select >'; for(var i = 0; i < dayCount.length; i++){ day = i + 1; list += '<option value="'+ day +'">'+ day +'</option>'; } list += '</select>'; document.getElementById('idof field that holds your drop down').innerHTML = list;}[/code] Quote Link to comment Share on other sites More sharing options...
fenway Posted December 30, 2006 Share Posted December 30, 2006 Why doesn't every use proper date widgets? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.