Answer the question
In order to leave comments, you need to log in
How can this JS be templated?
How can this JS be templated?
var h=(new Date()).getHours();
if (h > 3 && h < 12) document.writeln("Доброе утро, {login}!");
if (h > 11 && h < 18) document.writeln("Добрый день, {login}!");
if (h > 17 && h < 24) document. writeln("Добрый вечер, {login}!");
if (h > 23 || h < 4 ) document. writeln("{login}, почему не спишь?");
var h=(new Date()).getHours();
if (h > 3 && h < 12) document.writeln("<h4>Доброе утро, <div class="login-name">{login}</div>!</h4>");
if (h > 11 && h < 18) document.writeln("<h4>Добрый день, <div class="login-name">{login}</div>!</h4>");
if (h > 17 && h < 24) document. writeln("<h4>Добрый вечер, <div class="login-name">{login}</div>!</h4>");
if (h > 23 || h < 4 ) document. writeln("<h4><div class="login-name">{login}</div>, почему не спишь?</h4>");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question