使用内联javascript添加当前日期

Goo*_*ord 2 javascript date

运行以下代码时,输​​出中没有显示日期.我似乎无法弄清楚为什么约会不会出现......

<!DOCTYPE html>
<html>
<head>
 <title>document.write() Example</title>
</head>
<body>
 <p>The current date and time is:
 <script type=”text/javascript”>
 document.write(“<strong>” + (new Date()).toString() + “</strong>”);
 </script>
 </p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

Spe*_*rek 12

因为您使用这些类型的报价:“ ... ”.你需要使用" ... "

<script type="text/javascript">
    document.write("<strong>" + (new Date()).toString() + "</strong>");
</script>
Run Code Online (Sandbox Code Playgroud)

片段:

 document.write("<strong>" + (new Date()).toString() + "</strong>");
Run Code Online (Sandbox Code Playgroud)