I am in the process of teaching myself HTML, CSS, and Javascript from Sam's teach yourself book. The following example is an example of book examples I have had to recode to make them work. I have been able to figure out why all but this one would not work.
blah...blah...blah
<body>
<h1>blah.blah</h1>
<script type="text/javascript">
now = new Date();
localtime = now.toString();
utctime = now.toGMTString();
document.write("<p><strong>Local time:</strong> " + localtime + "</p>");
document.write("<p><strong>UTC time:</strong> " + utctime +"</p>");
...and so on ...
I had to run the javascript from a linked file. Has this type of inline scripting been deprecated since the book was published in 2014? If not, What am I missing?
Thanks for your replies.