开发者

inserting dynamic copyright with jQuery?

开发者 https://www.devze.com 2023-03-07 11:31 出处:网络
$(\"#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

$("#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

精彩评论

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