为了练习JavaScript中函数的使用方法,写了下面的关于Date()函数的使用,奇怪的是,网页中就是不显示相关内容,为什么呢???
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><title>Title学习使人快乐进步!</title><script >function testDate(){var date=new Date();document.write(date.getDate()+"<hr />"+"<br />");document.write(date.getDay()+"<hr />"+"<br />");document.write(date.getHours()+"<hr />"+"<br />");document.write(date.toLocaleString()+"<hr />"+"<br />");document.write(date.getDate()+"<hr />"+"<br />")document.write(date.getDay()+"<hr />"+"<br />")document.write(date.getFullYear()+"<hr />"+"<br />")document.write(date.getTimezoneOffset()+"<hr />"+"<br />")document.write(date.toLocaleString()+"<hr />"+"<br />")document.write(date.toLocaleDateString()+"<hr />"+"<br />")document.write(date.toDateString()+"<hr />"+"<br />")document.write(date.toLocaleTimeString()+"<hr />"+"<br />"document.write(date.toUTCString()+"<hr />"+"<br />")}testDate();</script></head> <body></body> </html>
你看看,是怎么回事呢???