日期:2014-05-16  浏览次数:20443 次

如何改 年份显示2012 PS:需要函数返回值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title>
 <script type="text/javascript"> 
function gND() {
 var now=new Date(); 
var mon= now.getMonth()+1;
 var day= now.getDate(); 
var year= now.getYear();
 var tgND=mon+"/"+day + "/"+ year;  
function year(number)
{ if(number<1000)
 { number = number+1900; } 
return number; }  
 function Time(number)
{ if(number<10){ number="0"+number; 
} return number; } return tgND;} </script>
 </head> <body> Hello !Today is 
 <script type="text/javascript"> 
var today= gND(); 
document.write(today); 
</script> 
 
</body> </html>

------解决方案--------------------
alert( new Date().getFullYear());