Basic Scripting


Javascript is a scripting language which when used in conjunction with html can provide programming logic and interactivity not found in html alone.

The first example shows how to include a javascript within an html page. It also demonstrates how to use alerts.
View Result

The second example shows how to include an external javascript file.
Here's the external javascript file called hi-script.js.
View Result

The third example shows the use of another kind of dialog box called prompt. It's used to get information from the user.
Here's the external javascript file called prompt-script.js. Note the name variable declaration.
View Result

In the fourth example, we can see that javascript allows for doing arithmetic and can also write directly to our web page and not just to dialog boxes.
Here's the external javascript file called write.js. Note the ability to write html tags.
View Result



Sample Projects