/*//全局变量
var a=1;
function show(){
//局部变量
var b=2;
alert(a);
}
show();
alert(b);
*/
/*var d1=new Date();//当前日期时间对象
document.write(d1.toString()+"<br>");
//指定日期时间对象
var d2=new Date("2050-02-02 12:53:52");
document.write(d2.toString()+"<br>");
//创建指定年月日时间对象
var d3=new Date("1998,08,08");
document.write(d3.toString()+"<br>");*/
var d=new Date();
var year=d.getFullYear();
var month=d.getMonth()+1;
var day=d.getDate();
var week=d.getDay();
var hour=d.getHours();
var minutes=d.getMinutes();
var seconds=d.getSeconds();
document.write("今天是"+year+"年"+month+"月"+day+"日"+"星期"+week+","+hour+":"+minutes+":"+seconds+"<br>");
//获取当前日期的毫秒值
document.write(d.getTime());
转载于:https://www.cnblogs.com/G-qz/p/10708665.html