It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                9年前关闭。
            
                    
$(document).ready(function(){

    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();

    var month = new array("January","February","March","April","May","June","July","August","September","October","November","December");

    var mon;
    mon = month(m);

    var today = m+"/"+d+"/"+y
    $('#calendar').append('<div id="today">Today is'+' '+mon+'/'+d+'/'+y+'.');

});

最佳答案

代替mon = month(m);使用方括号表示法:mon = month[m];new array()应该为new Array()或更佳,使用数组文字,例如['First','Second','Third']

$(document).ready(function(){

    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();

    var month = ["January","February","March","April","May","June","July","August","September","October","November","December"];

    var mon;
    mon = month[m];

    var today = m+"/"+d+"/"+y
    $('#calendar').append('<div id="today">Today is'+' '+mon+'/'+d+'/'+y+'.');

});

10-04 23:02
查看更多