top of page

How to run Java Script

There are many Java scripts available that can assist you with data analysis. Running a java script is quite easy - they run in a web browser when embedded in a html file.

This sample Java 'Digital clock' script can be found here

<html> <head> <title>Javascript Digital Clock - An example of a Timer</title>

<script language="javascript" type="text/javascript">var dateform speed=1000 tid=0;function dodate(){ Date();tid=window.setTimeout("dodate()",speed);}function start(x){f=x tid=window.setTimeout("dodate()",speed);}function cleartid(){window.clearTimeout(tid);}</script>


<body onload="start(document.dateform) ;"> <center> Digital Clock <FORM name="dateform" action="post"> <input type="text" name="date" size=30> </FORM> </center>

<br><br> <a href="jsindex.html"> More java script examples </a> <br>

</body> </html>

. . . it can be pasted into a text file [make sure the returns appear in the right places] and then save and change the extension to .html. Depending on your settings in Windows, simply clicking on the file should open it in Internet Explorer. You will likely get a warning that running scripts are restricted and be prompted by IE to allow block content. Click 'Allow blocked content' and let the script run.

You should get a result that looks just like the below, where I have embedded the Java script

If a Java script is not embedded in an html file, you can run it by downloading Node, from this site, . Once Node is installed, you should find it your Programs menu Open it and simply type in:

node C:\folder\hello.js

Java scripts not embedded in html files are saved with the extension .js.

bottom of page