On my previous post, I talked about HTML and CSS.  Now I’m going to talk about Javascript

Javascript is a popular scripting language that makes an HTML page dynamic.  To add Javascript code, you use the _

<script type="text/javascript"\> function myFunction() { alert("Hello, Universe!!!"); } </script> <p style="font-weight: bold; color: #0000FF" onclick="myFunction()"\> Hello, World!!! </p>

Remember that Javascript code are executed as the HTML page is being parsed.  The example below will display the message when the HTML page is being loaded without having to wait for any event.  Notice that the Javascript code is not contained in a function declaration like the example above.

<script type="text/javascript"\> alert("Javascript code not belonging to any function"); </script>

If you have lots of Javascript code, it is preferred to put them in an external file with extension .js and use the _

<script src="MyJavaScript.js"\></script> <p style="font-weight: bold; color: #0000FF" onclick="myAnotherFunction()"\> Hello, World!!! </p>

The file MyJavascript.js contains the following Javascript code:

function myAnotherFunction()
{
alert(“Hello, Big Bang!!!”);
}

Next post, I’ll cover the jQuery.