我正在学习网络编程的基础知识。我有这个HTML和这个.js:
<!--index.html-->
<html>
<head>
<title>Client</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script type="text/javascript" src="client.js"></script>
</body>
</html>
/* client.js */
function currentDate(){
var now = newDate();
document.writeln(now.toDateString());
document.write("hey!");
}
currentDate();
我在我的localhost上运行index.html并且它什么也没显示。空页面。我在这里错过了什么?我不知道出了什么问题。我希望它写出日期和单词&#34;嘿!&#34;。
答案 0 :(得分:6)
你错过了一个空格:
var now = new Date();