CMChalcraft
asked on
Html 5 code
Hi,
I cannot get this script to show the date and time. Tried IE, Safari and Chrome. What is wrong?
Trying the learn Javascript with html and this is the first exercise!
Need help.
Regards
Chris
I cannot get this script to show the date and time. Tried IE, Safari and Chrome. What is wrong?
Trying the learn Javascript with html and this is the first exercise!
Need help.
Regards
Chris
<!DOCTYPE html>
<html lang=“en”>
<head>
<title>Displaying Time and Dates</title>
</head>
<body>
<h1>Current Date and Time</h1>
<script type=“text/javascript”>
now = new Date();
localtime = now.toString();
utctime = now.toGMTString();
document.write(“<p><strong>Local time:</string> “ + localtime + “</p>”);
document.write(“<p><strong>UTC time:</strong> “ utctime + “</p>”);
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
CMChalcraft, did you mean to give Mark the points for this?
Also, a very good text editor for mac http://www.barebones.com/products/textwrangler/ (free) http://brackets.io/ (free) https://www.jetbrains.com/webstorm/
Also, a very good text editor for mac http://www.barebones.com/products/textwrangler/ (free) http://brackets.io/ (free) https://www.jetbrains.com/webstorm/
ASKER
Very quick response.
I fixed the first closing tag for strong.
And this displays the date and time.
Open in new window