开发者

inserting dynamic copyright with jQuery?

$("#footer").append("<p>&copy; 2011</p>");

Is there a way to make the year update on its own开发者_开发技巧?


Why don't you use php instead ? Stick some php code that retrieves the current year in your paragraph tag and you're done ;)


var today = new Date;
var year = today.getFullYear();
$("#footer").append("<p>&copy; "+ year + "</p>");


try:

$("#footer").append( "<p>&copy; " + (new Date).getFullYear() + "</p>");


$("#footer").append( "<p>&copy; " + (new Date).getFullYear() + "</p>"); 


$("#footer").append( "<p>&copy; " + (new Date).getFullYear() + "</p>");


This may work:

var d=new Date();  
$("#footer").append("<p>&copy; "+ d.getFullYear() +"</p>");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜