how and why
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by how and why
-
-
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.
book example of inline javascript won't work
in JavaScript
Posted
dsonesuk,
Thanks for the reply. This is humbling. The occurrence of both "utc" and "GMT" in the same line of code should have captured my attention. The devil is in the details.