1

こんにちは、テーブル内に配置された月ピッカーを表示できません。

<!DOCTYPE html>
<head>
    <script src="js/libs/jquery-1.9.1.js"></script>
        <link rel="stylesheet" href="css/jquery-ui.css" />
<script src="js/libs/jquery-ui-1.10.3.custom.min.js"></script>  
$(function() {
    $('.date-picker').datepicker( {
        changeMonth: true,
        changeYear: true,
        showButtonPanel: true,
        dateFormat: 'MM yy',
        onClose: function(dateText, inst) { 
            var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
            var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
            $(this).datepicker('setDate', new Date(year, month, 1));
        }
    });
});
</script>
<script>
        window.onload = function () {
  PreLoadSection();
</script>
<style>
.ui-datepicker-calendar {
    display: none;
    }
</style>


</head>
<body>
<div id="variables" name="variables" style="width:100%; overflow:auto; overflow: scroll;">          
    </div>  
</body>
</html>

上は私のhtmコードで、下は私の.jsファイルです

function PreLoadSection()
{
 LoadSectionStratified();
}
function LoadSectionStratified() {
   $('#variables').append($('<table id="variables_table">'));
  $('#variables').append($('<tr>'));
  $('#variables').append('<th style="border: 10px">month picker</th>');
      $('#variables').append($('</tr>'));

   $('#variables').append($('<tr>'));
   AddDate_MonthYear_StratifiedSection();
 $('#variables').append($('</tr>'));
     $('#variables').append($('</table>'));
 $('#variables').trigger('create');
}

function AddDate_MonthYear_StratifiedSection() {
 table_html = '<td style="min-width: 200px;"><input name="name1" id="id1" value="" class="date-picker"></td>';
 $('#variables').append(table_html);
}

上記のコードはそれを実装する方法ですが、機能しません。Firefox バージョン 24 を使用しています。ウィンドウの読み込み時に、LoadSectionStratified 関数を呼び出すプリロード関数を呼び出します。

4

1 に答える 1