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 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.

This line below gives a greeting depending on the time of the day.

Javascript good morning html: automatic generated text:


Test


The <h4 id="greeting">test</h4> is just like a normal header. But now it also has an ID-label.

And then you can manipulate the content of that header with the following commando:

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>


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 Infonosity.net

Back to Computers en Elektronica (Dutch)