Computer English Varia-Vrije_tijd

Javascript good morning html.

Javascript good morning html: How can you display a time dependent greeting on your HTML website (or WordPress) using JavaScript?

Javascript good morning html : This good morning afternoon evening javascript is about: How can you display a time dependent greeting on your HTML website (or WordPress) using JavaScript?

Javascript is a very simple programming langue. You can use javascript separate to write simple programs. But in this case we are going to use it in combination with html. In this example I use it to send an automatic greeting. Everywhere in the world it is a different hour. And so if someone comes to your site and you wish to send them an appropriate greeting. Then you do not know whether it is day or night there. and for that we use this script. It checks the time of your visitor. And then adjusts the notification via the H4 tag that we have given an ID. So other H4 tags are not modified.

javascript good morning html. - good morning javascript in html - good morning afternoon evening javascript

Javascript good morning html in action: This line below gives a greeting depending on the time of the day.

Javascript good morning html: automatic generated text:


Javascript good morning - how it works:

  1. The <h4 id="greeting">test</h4> is just like a normal header. But now it also has an ID-label.
  2. Then starts the actual goodmorning javascript.
  3. dt= a variable that is filled with the current hour. (At the PC of the visitor)
  4. Then it if a simple 'if' function in our javascript.
  5. Depending on the time, another text is written to the H4-banner.
  6. writing to the html file from javascript is with the following commando:
  7. document.getElementById("greating").innerHTML='your new text'

You can also put your script in a separate file. example 'main.js' and you call this script from within the html page with the following code:

<script src='main.js'></script>

More programming fun:

On this site you will find other simple examples to take the first steps in programming. Even some computer games !!! See for example in this YouTube video:

Or the Corona Shooter Game in C# tutorial. You can play it here (free download) but also find the source code to program the game itself. Just by using other drawings, you can make another game. For example, a 2D space shooter.

How does this game look like? I made a short YouTube video. But again you can make a completely different game. Just by using other drawings.

More javascript fun?

NEW: How to draw fractals in HTML using Javascript.

Back to English

Back to Computers en Elektronica (Dutch)