<script>
$(function() {
$("#form_status_added").click(function () {
var number_data = $("#form_data_number").text();
number_data++;
$("#form_data_number").html(number_data);
$("<div class='param'><select name='input_name[10]' id='month' onchange='days()'><?php echo $monthOptions; ?> </select></div>" ).insertBefore("#form_status_added");
}) });
</script>
<?php
$monthOptions = '<option value="0">Месяц</option>';
$dayOptions = '<option value="0">День</option>';
$yearOptions = '<option value="0">Год</option>';
$monthName = array(null,"Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь");
foreach ($monthName as $key){
for($month=0;$month<count($key);$month++)
{
$monthName = date("F", mktime(0, 0, 0, $month));
$monthOptions .= "<option value=\"{$month}\">{$key}</option>\n";
}}
for ($day=1;$day<=31;$day++)
{
$dayOptions .= "<option value=\"{$day}\">{$day}</option>\n";
}
for ($year=2013;$year>=1920;--$year)
{
$yearOptions .= "<option value=\"{$year}\">{$year}</option>\n";
}
?>
<script type="text/javascript">
function days() {
var monthSel = document.getElementById('month').value;
var daySel = document.getElementById('day');
var dayInmonth = 31;
if (monthSel == 2)
{
dayInmonth = 29;
}
else if (monthSel == 4 || monthSel == 6 || monthSel == 9 || monthSel == 11)
{
dayInmonth = 30;
}
if (daySel.options.length > daysInmonth)
{
daySel.options.length = daysInmonth;
}
while (daySel.options.length != daysInmonth)
{
daySel.options[daySel.length] = new Options(daySel.length+1, daySel.length+1, false);
}
return;
}
</script>
вот другой код, но опять не выводится функция