how and why Posted July 8, 2017 Share Posted July 8, 2017 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. Link to comment Share on other sites More sharing options...
dsonesuk Posted July 8, 2017 Share Posted July 8, 2017 (edited) toGMTString() -> Deprecated. Use the toUTCString() method instead, as stated from here https://www.w3schools.com/jsref/jsref_obj_date.asp Edited July 8, 2017 by dsonesuk 1 Link to comment Share on other sites More sharing options...
how and why Posted July 9, 2017 Author Share Posted July 9, 2017 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now