JavaScript is not related to the Java language. It some ways, it has more similarities to other shell scripts like POSIX Shell and BASH. It falls into the interpreted languages group. This page will have the following sections:

  1. Imbedded in HTML
  2. Shell Script JavaScript
  3. React JavaScript Library

The Standalone section will double as the Eclipse JavaScript section.

Imbedded in HTML

JavaScript is the default scripting language of HTML. If there is something that you want an item to do on an html page, then you use JavaScript. For example, changing the text color for a button label.

The color being displayed is represented by the following number:


The code for this is as follows (as a side note, if you are using a WordPress editor, once you have scripts or example scripts like what follows, DO NOT switch back to Visual mode from Text mode, or else all your indent formatting will be lost and the function in the “script” will be all condensed into a single line. Also, when I did this the JavaScript call was deleted from the button description. It is hard to do any maintenance on the code then):

<input id="changeColor" type="button" value="Change Color" onclick="setButtonColor();" />

The color being displayed is represented by the following number:

<a id="demo">#000000</a>
function setButtonColor() {
    var color=0;
    switch (Math.floor((Math.random() * 6) + 1)) {
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
      case 6:
document.getElementById("changeColor").style.color = color;
document.getElementById("demo").innerHTML = color;

Shell Script JavaScript

I am using Eclipse to create these examples. I will be using this section to both discuss stand-alone scripts and the Eclipse Development Environment.

React JavaScript Library

React is one of the more commonly used JavaScript Libraries. As I learn it, I will add more information here.