Fixed Size Table-2 Format Individual Cells


An earlier post permitted formatting for the entire table only. This post allows cells to be individually formatted.
Here is an example of how it looks:

Click Image for larger view

fxtab2-format

As you can see, each cell is formatted differently.

Here is the code;

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'&gt;
<html xmlns='http://www.w3.org/1999/xhtml'&gt;
<head profile='http://gmpg.org/xfn/11'&gt;
<title>Enter Title Here</title>
<style>
body {margin-left:0;margin-right:0;font:normal normal normal 12pt Arial;}a{ text-decoration: }:link { color: rgb(0, 0, 255) }:visited {color :rgb(100, 0,100) }:hover { }:active { }
#table1{position: relative; top: 0; border-collapse: collapse;font:normal normal normal 12pt Arial; visibility: hidden }
td{position:relative; width: 150px; height: 100px; border: 1px solid black; padding: 0}
div{position:relative; width: 150px; height: 100px; white-space: pre-wrap; overflow-y: auto; padding: 5px; background: #fbfbfb}
input, select {position: relative; width: 120px; font:normal normal normal 12pt Arial; }
#bld, #ital,#fnt {width:15px}
#frame{position: absolute; left:0 ; top:0 ; width:100% ; height: 100%; }
#frmat{position:absolute; left: 10%; top: 0; width: 250px; height: 195px; visibility: hidden}
@font-face { font-family: ‘Cancun’;src: url(cancunn-webfont.eot’);src: url((cancunn-webfont.eot?#iefix’) format(’embedded-opentype’),url(‘(cancunn-webfont.woff’) format(‘woff’),url(‘(cancunn-webfont.ttf’) format(‘truetype’),url(‘(cancunn-webfont.svg#CancunPlain’) format(‘svg’);font-weight: normal;font-style: normal;}
@font-face { font-family: ‘Snell Blk BT’;src: url(snellk-webfont.eot’);src: url((snellk-webfont.eot?#iefix’) format(’embedded-opentype’),url(‘(snellk-webfont.woff’) format(‘woff’),url(‘(snellk-webfont.ttf’) format(‘truetype’),url(‘(snellk-webfont.svg#Snell’) format(‘svg’);font-weight: normal;font-style: normal;}
</style>
</head>
<body>

Bold Italic Font font faceTimes New RomanArialGeorgiaVerdanaComic Sans MSImpact Embed FontCancunSnell Blk BT

<table id=”table1″ align=”center”>
<textarea id=”frmat” ondblclick=’format2();’></textarea>

var wd = “150px”; var ht = “100px”; var str = “”; var rows = “4”; var cols = “5”; var frmat = false; var el; var el3;

document.onkeyup =KeyCheck;
function KeyCheck(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;
switch(KeyID)
{
case 27:
restore();
}
}

function format2() {
document.getElementById(“table1″).style.visibility=”visible”;
document.getElementById(“table1″).style.top=”0”;
el.innerHTML = document.getElementById(“frmat”).value;
document.getElementById(“frmat”).style.visibility=”hidden”;
document.getElementById(“frame”).style.visibility=”hidden”;
}

function format() {
el = document.activeElement;
document.getElementById(“table1″).style.top=”200px”;
document.getElementById(“frame”).style.visibility=”visible”;
frmat = true;
}

function restore() {
document.getElementById(“table1″).style.visibility=”hidden”;
document.getElementById(“frame”).style.visibility=”visible”;
document.getElementById(“sel”).value = “font face”;
document.getElementById(“sel2”).value = “Embed Font”;
document.getElementById(“table1”).style.fontWeight = “normal”;
document.getElementById(“table1”).style.fontStyle = “normal”;
frmat = false;
str = “”;
}

function insertText(str1, str2) {
el3 = document.getElementById(“frmat”);
el3.focus();
var selectionText = el3.value.substr(el3.selectionStart, el3.selectionEnd – el3.selectionStart);
el3.value = el3.value.replace(selectionText, str1 + selectionText + str2);
document.getElementById(“sel”).value = “font face”;
document.getElementById(“sel2”).value = “Embed Font”;
document.getElementById(“bld”).checked = false;
document.getElementById(“ital”).checked = false;
document.getElementById(“fnt”).checked = false;
document.getElementById(“color”).value = “#000000”;
document.getElementById(“sz”).value = “font size eg 12”;
}

function showTable() {
if (frmat) {
document.getElementById(“frmat”).style.visibility=”visible”;
if (! document.getElementById(“bld”).checked && ! document.getElementById(“ital”).checked && ! document.getElementById(“fnt”).checked) document.getElementById(“frmat”).value = el.innerHTML;
if (document.getElementById(“bld”).checked) insertText(““,”“);
if (document.getElementById(“ital”).checked) insertText(““,”“);
if (document.getElementById(“sel2”).value != “Embed Font”) {
var s3 = document.getElementById(“sel2”).value;
} else {
s3 = document.getElementById(“sel”).value;
}
if (document.getElementById(“fnt”).checked) insertText(““, ““);
}
if (! frmat) {
if (document.getElementById(“rows”).value != “# rows”) rows = document.getElementById(“rows”).value;
if (document.getElementById(“cols”).value != “# columns”) cols = document.getElementById(“cols”).value;
if (document.getElementById(“wd”).value != “width eg; 150”) wd = document.getElementById(“wd”).value;
if (document.getElementById(“ht”).value != “height eg; 100”) ht = document.getElementById(“ht”).value;
for (var i=1; i’;
for (var j=1; j

‘;
}
str += ‘

‘;
}
document.getElementById(“table1”).innerHTML=str;
if (document.getElementById(“sz”).value != “font size eg 12”) {
document.getElementById(“table1”).style.fontSize = document.getElementById(“sz”).value + “pt”;
} else {
document.getElementById(“sz”).value = “5”;
}
if (document.getElementById(“bld”).checked) document.getElementById(“table1”).style.fontWeight = “700”;
if (document.getElementById(“ital”).checked) document.getElementById(“table1”).style.fontStyle = “italic”;
document.getElementById(“table1”).style.color = document.getElementById(“color”).value;
if (document.getElementById(“sel”).value != “font face”) {
document.getElementById(“table1”).style.fontFamily = document.getElementById(“sel”).value;
} else {
document.getElementById(“sel”).value = “Arial”;
}
if (document.getElementById(“sel2”).value != “Embed Font”)
document.getElementById(“table1”).style.fontFamily=document.getElementById(“sel2”).value;
document.getElementById(“table1″).style.visibility=”visible”;
document.getElementById(“frame”).style.visibility=”hidden”;
}
}

</body></html>


Double clicking a cell brings back the interface. Hitting GO then opens a textarea with the cell text inserted:

Click Image for larger view

ta-popup

HTML tags can be inserted in the textarea by choosing values,selecting some text and hitting GO. When the textarea is doubleclicked, the selected cell is formatted.

The following code does the formatting:
if (frmat) {
document.getElementById(“frmat”).style.visibility=”visible”;
if (! document.getElementById(“bld”).checked && ! document.getElementById(“ital”).checked && ! document.getElementById(“fnt”).checked) document.getElementById(“frmat”).value = el.innerHTML;
if (document.getElementById(“bld”).checked) insertText(“<b>”,”</b>”);
if (document.getElementById(“ital”).checked) insertText(“<i>”,”</i>”);
if (document.getElementById(“sel2”).value != “Embed Font”) {
var s3 = document.getElementById(“sel2”).value;
} else {
s3 = document.getElementById(“sel”).value;
}
if (document.getElementById(“fnt”).checked) insertText(“<font face=\”” + s3 + “\” color=\”” + color.value + “\” size=\”” + sz.value + “\”>”, “</font>”);
}
el3 = document.getElementById(“frmat”);
el3.focus();
var selectionText = el3.value.substr(el3.selectionStart, el3.selectionEnd – el3.selectionStart);
el3.value = el3.value.replace(selectionText, str1 + selectionText + str2);

This post uses HTML tags for the formatting. The next installment will use styles, allowing more versatility.

Using Robocopy to Backup Partitions

Robocopy is a command line application that copies entire contents of folders. It also has switches that allow for incremental backups as well has other things.

Below is a batch file to backup a sdcard used to expand the storage of a Cloudbook:

robocopy “D:\Programs” “E:\DBackup\Programs” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\microemulator-2.0.4” “E:\DBackup\microemulator-2.0.4” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Spasm” “E:\DBackup\Spasm” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\win3” “E:\DBackup\win3” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\3dSynth” “E:\DBackup\3dSynth” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Any Video Converter” “E:\DBackup\Any Video Converter” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Blog” “E:\DBackup\Blog” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:Download” “E:\DBackup\Download” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:Folders” “E:\DBackup\Folders” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Fonts” “E:\DBackup\Fonts” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\HTML” “E:\DBackup\HTML” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Images” “E:\DBackup\Images” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\lcc” “E:\DBackup\lcc” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\jdk1.6.0_06” “E:\DBackup\jdk1.6.0_06” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\portables” “E:\DBackup\portables” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Xampp” “E:\DBackup\Xampp” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Shortcuts” “E:\DBackup\Shortcuts” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Misc” “E:\DBackup\Misc” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Batch Files” “E:\DBackup\Batch Files” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\DEM” “E:\DBackup\DEM” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Documents” “E:\DBackup\Documents” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\NirSoft” “E:\DBackup\NirSoft” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\My Pictures” “E:\DBackup\My Pictures” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Canon” “E:\DBackup\Canon” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Google” “E:\DBackup\Google” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Temp” “E:\DBackup\Temp” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Zips” “E:\DBackup\Zips” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\SystemApps” “E:\DBackup\SystemApps” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\WinSxS” “E:\DBackup\WinSxS” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\src” “E:\DBackup\src” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Microsoft Visual C++ Build Tools” “E:\DBackup\Microsoft Visual C++ Build Tools” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Microsoft Visual Studio 14.0” “E:\DBackup\Microsoft Visual Studio 14.0” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Appdata” “E:\DBackup\Appdata” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Macrium” “E:\DBackup\Macrium” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Manuscript Player” “E:\DBackup\Manuscript Player” /XO /NFL /NDL /S /R:1 /W:10
robocopy “D:\Maps” “E:\DBackup\Maps” /XO /NFL /NDL /S /R:1 /W:10

The basic command is robocopy “source folder” “destination folder” /Switches

The important switches here are:
/XO: overwrite only if newer
/S: include subfolders
/R:1: retry only once if there is an error copying a particular file; otherwise it would try infinitely
/W:10: After an error wait 10 seconds before testing the retry switch. I think the default is 30 seconds

A HTML Customizable Fixed Dimension Interactive Table 1


Tables are convienent for the orderly arrangement of a web page interface and the cells can be made editable. The text inside a cell can also be selected and formatted. There is one problem, however. If the contents of a cell exceed its size, it expands, expanding the size of the entire row, thus destroying the symmetry of the table. It would be better if the individual cells could be scrolled.

This could be accomplished by filling the cells with textareas, which are editable and scrollable. However there is a problem in that textareas, although capable of being formatted, the format applies to the entire textarea, rather than to selected text. Thus another method must be found.

Divisions can now be made editable and selected text within a division can be formatted. This is therefore the way to go.

I will include several installments of this theme. The first one will include the basic interface. The formatting, however, will apply only to the entire table.

Here is the code:

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'&gt;
<html xmlns='http://www.w3.org/1999/xhtml'&gt;
<head profile='http://gmpg.org/xfn/11'&gt;
<title>Enter Title Here</title>
<style>
body {margin-left:0;margin-right:0;font:normal normal normal 12pt Arial;}a{ text-decoration: }:link { color: rgb(0, 0, 255) }:visited {color :rgb(100, 0,100) }:hover { }:active { }
#table1{position: relative; top: 0; border-collapse: collapse;font:normal normal normal 12pt Arial; visibility: hidden }
td{position:relative; width: 150px; height: 100px; border: 1px solid black; padding: 0}
div{position:relative; width: 150px; height: 100px; white-space: pre-wrap; overflow-y: auto; padding: 5px; background: #eeeeee}
input, select {position: relative; width: 120px; font:normal normal normal 12pt Arial; }
#bld, #ital {width:15px}
#frame{position: absolute; left:0 ; top:0 ; width:100% ; height: 100%; }
@font-face { font-family: ‘Cancun’;src: url(cancunn-webfont.eot’);src: url((cancunn-webfont.eot?#iefix’) format(’embedded-opentype’),url(‘(cancunn-webfont.woff’) format(‘woff’),url(‘(cancunn-webfont.ttf’) format(‘truetype’),url(‘(cancunn-webfont.svg#CancunPlain’) format(‘svg’);font-weight: normal;font-style: normal;}
@font-face { font-family: ‘Snell Blk BT’;src: url(snellk-webfont.eot’);src: url((snellk-webfont.eot?#iefix’) format(’embedded-opentype’),url(‘(snellk-webfont.woff’) format(‘woff’),url(‘(snellk-webfont.ttf’) format(‘truetype’),url(‘(snellk-webfont.svg#Snell’) format(‘svg’);font-weight: normal;font-style: normal;}
</style>
</head>
<body>
<div id=”frame”>
<input type=”text” id=”rows” name=”rows” value=”# rows” onclick=’document.getElementById(“rows”).value = “”;’ /> <input type=”text” id=”cols” name=”cols” value=”# columns” onclick=’document.getElementById(“cols”).value = “”;’ /> <input type=”text” id=”wd” name=”wd” value=”width eg; 150″ onclick=’document.getElementById(“wd”).value = “”;’ /> <input type=”text” id=”ht” name=”ht” value=”height eg; 100″ onclick=’document.getElementById(“ht”).value = “”;’/> <input type=”text” id=”sz” name=”sz” value=”font size eg 10″ onclick=’document.getElementById(“sz”).value = “”;’ /> <input type=”checkbox” id=”bld” name=”bld” value=”bold”>Bold <input type=”checkbox” id=”ital” name=”ital” value=”italic”>Italic <input type=’color’ id=’color’ value= simple color /> <select id=”sel”><option>font face</option><option>Times New Roman</option><option>Arial</option><option>Georgia</option><option>Verbana</option><option>Comic Sans MS</option><option>Impact</option></select> <select id=”sel2″><option>Embed Font</option><option>Cancun</option><option>Snell Blk BT</option></select><br />
<input type=”button” id=”b1″ name=”b1″ value=”Show Table” onclick=’showTable();’ />
<table id=”table1″ align=”center”>

var wd = “150px”; var ht = “100px”; var str = “”; var rows = “4”; var cols = “5”;

document.onkeyup =KeyCheck;
function KeyCheck(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;
switch(KeyID)
{
case 27:
restore();
}
}

function restore() {
document.getElementById(“table1″).style.visibility=”hidden”;
document.getElementById(“frame”).style.visibility=”visible”;
document.getElementById(“sel”).value = “font face”;
document.getElementById(“sel2”).value = “Embed Font”;
document.getElementById(“table1”).style.fontWeight = “normal”;
document.getElementById(“table1”).style.fontStyle = “normal”;
str = “”;
}

function showTable() {
if (document.getElementById(“rows”).value != “# rows”) rows = document.getElementById(“rows”).value;
if (document.getElementById(“cols”).value != “# columns”) cols = document.getElementById(“cols”).value;
if (document.getElementById(“wd”).value != “width eg; 150”) wd = document.getElementById(“wd”).value;
if (document.getElementById(“ht”).value != “height eg; 100”) ht = document.getElementById(“ht”).value;

for (var i=1; i’;
for (var j=1; j

‘;
}
str += ‘

‘;
}
document.getElementById(“table1”).innerHTML=str;
if (document.getElementById(“sz”).value != “font size eg 10”) document.getElementById(“table1”).style.fontSize = document.getElementById(“sz”).value + “pt”;
if (document.getElementById(“bld”).checked) document.getElementById(“table1”).style.fontWeight = “700”;
if (document.getElementById(“ital”).checked) document.getElementById(“table1”).style.fontStyle = “italic”;
document.getElementById(“table1”).style.color = document.getElementById(“color”).value;
if (document.getElementById(“sel”).value != “font face”)document.getElementById(“table1”).style.fontFamily = document.getElementById(“sel”).value;
if (document.getElementById(“sel2”).value != “Embed Font”) document.getElementById(“table1”).style.fontFamily=document.getElementById(“sel2”).value;
document.getElementById(“table1″).style.visibility=”visible”;
document.getElementById(“frame”).style.visibility=”hidden”;
}

</body></html>


Here is how the interface looks:

Click Image for larger view

tablemaker-interface

Here is the code to set up the table:


if (document.getElementById(“rows”).value != “# rows”) rows = document.getElementById(“rows”).value;
if (document.getElementById(“cols”).value != “# columns”) cols = document.getElementById(“cols”).value;
if (document.getElementById(“wd”).value != “width eg; 150”) wd = document.getElementById(“wd”).value;
if (document.getElementById(“ht”).value != “height eg; 100”) ht = document.getElementById(“ht”).value;
for (var i=1; i<=rows;i++) {
str +='<tr>’;
for (var j=1; j<=cols;j++) {
str += ‘<td id=”td’ + i + j + ‘” style=”width: ‘ + wd + ‘; height: ‘ + ht + ‘”>

</td>’;
}
str += ‘<br /></tr>’;
}
document.getElementById(“table1”).innerHTML=str;


The number of rows and columns, as well as the cell size is set from the values of the text input boxes.
The format is set from either the font face or Embed Font selects as well as the color input, font size text input and bold and italic checkboxes.
There are default values for all parameters, so no values must be set.

Here is how a formatted table appears:

Click Image for larger view

formatted-text

Here is the code to format the table:


if (document.getElementById(“sz”).value != “font size eg 10”) document.getElementById(“table1”).style.fontSize = document.getElementById(“sz”).value + “pt”;
if (document.getElementById(“bld”).checked) document.getElementById(“table1”).style.fontWeight = “700”;
if (document.getElementById(“ital”).checked) document.getElementById(“table1”).style.fontStyle = “italic”;
document.getElementById(“table1”).style.color = document.getElementById(“color”).value;
if (document.getElementById(“sel”).value != “font face”)document.getElementById(“table1”).style.fontFamily = document.getElementById(“sel”).value;
if (document.getElementById(“sel2”).value != “Embed Font”) document.getElementById(“table1”).style.fontFamily=document.getElementById(“sel2”).value;


I have also demonstrated the method for embedding fonts not native to html. Of course the font must be installed on the computer.

A HTML Statistical Calculator with Graphing


This app will take a number of points, calculate the mean, standard deviation and % standard deviation and make a plot of the points, with a line for the mean and two lines showing the limits of one standard deviation.

Here is how the graph appears:

Click Image for larger view

statgraph

Here is the code:

<!DOCTYPE html PUBLIC ‘-//W3C//DTD XHTML 1.0 Transitional//EN’ ‘http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd’&gt;
<html xmlns=’http://www.w3.org/1999/xhtml’&gt;
<head profile=’http://gmpg.org/xfn/11′&gt;
<title>Statistcal Graph</title>
<style type=’text/css’>
body {margin-left:0;margin-right:0;font:normal normal normal 12px Arial; white-space: pre-wrap}
a{ text-decoration: }
:link { color: rgb(0, 0, 255) }
:visited {color :rgb(100, 0,100) }
:hover { }
:active { }
input, select {position: relative; font:normal normal normal 15pt Arial; left: 10px}
#total{ width: 96%}
#s1l{width: 200px;}
#b1{ width: 100px}
#svg1{position: absolute; left:0 ; top:0 ; width:100% ; height:100% ; visibility: hidden; background: white}
</style>
<body>
<input type=”text”id=”total” name=”total” value=”values” /><br />
<select name=”s1″ id=”s1″ onChange=”insert(this.options[this.selectedIndex].value);”>
<option>Calculation</option>
<option>Mean</option>
<option>Standard Deviation</option>
<option>% Standard Deviation</option>
</select><br />
<input type=”button”id=”b1″ name=”b1″ value=”Graph” onclick=’grph();’ />
<svg id=”svg1″ xmlns=”http://www.w3.org/2000/svg&#8221; version=”1.1″ width=”” height=”” ondblclick=’document.getElementById(“svg1″).style.visibility=”hidden”;’></svg>

var val2 = “”; var meanval = 0; var tot = “”; var cn = 0; var num = 0; var a; var b; var dev; var xold = 0; var yold = 0;
var max3 = 0; var xold = 0; var yold = 0; var wdth = 0; var max = 1; var ht = screen.height; var wd = screen.width; var max2 = .7 * ht; var dev2 = 0;

function insert(val) {
var tbox = document.getElementById(“total”);
tot = tbox.value;
val2 = val;
if (val == “Mean”) {
tot = getMean();
meanval = tot;
tot = tot.toFixed(3);
}
if (val == “Standard Deviation” || val == “% Standard Deviation”) {
dev = 0;
for (var i = 0; i max) max = va[i];
}

wdth =Math.floor( wd / (cn+1));
xold = wdth;
for (var i = 0 ; i 0) {
document.getElementById(“svg1″).innerHTML += ”;
document.getElementById(“svg1″).innerHTML += ”;
document.getElementById(“svg1″).innerHTML += ”;
document.getElementById(“svg1”).innerHTML += ‘ ‘;
document.getElementById(“svg1″).innerHTML += ”;
}
yold = ht – Math.floor(max3);
xold = (wdth*(i + 1));
}
var txtstr = “Mean ” + meanval.toFixed(3) + ” Std Dev ” + dev2.toFixed(3);
document.getElementById(“svg1″).innerHTML += ” + txtstr + ”;
document.getElementById(“svg1”).style.visibility = “visible”;
}

</head>

</body></html>

The interface has an input box, a select box and a button.
Each number is entered followed by a comma, including the last number. The mean, standard deviation and % standard deviation can then be selected and their values read. Finally clicking the button will show the graph. Double clicking the graph will go back to the interface.

The mean is calculated by the function getMean():
function getMean() {
var s = 0;
getVa();
num = cn-1;
for(var i = 0; i <= cn – 1; i ++) {
va[i] = eval(va[i]);
s = s + va[i];
}
s = s /cn;
return s;
}

The standard deviation and % standard deviation are calculated with the following code:
dev = 0;
for (var i = 0; i <= cn – 1; i ++) {
var diff = va[i] – meanval;
diff = Math.pow(diff,2);
dev += diff;
}
dev /= cn;
dev = Math.sqrt(dev);
dev2 = dev;
if (val == “% Standard Deviation”) dev = dev * (100/meanval);
tot = dev.toFixed(3);

The function grph() does the plotting:
function grph() {
var max4; var max5; var max6;
document.getElementById(“svg1”).innerHTML = “”;
var grp = “”
var fil = “black”;
for (var i = 0; i <= cn – 1; i ++) {
if (va[i] > max) max = va[i];
}

wdth =Math.floor( wd / (cn+1));
xold = wdth;
for (var i = 0 ; i <= cn – 1; i ++) {
max3 = (va[i] / max) * max2 + 125;
max4 = (meanval / max) * max2 + 125;
max5 = ((meanval + dev2) / max) * max2 + 125;
max6 = ((meanval – dev2) / max) * max2 + 125;
if (i > 0) {
document.getElementById(“svg1″).innerHTML += ‘<line stroke-width=”1” x1 = “‘ + xold + ‘” x2 = “‘ + (wdth*(i + 1)) + ‘” y1=”‘ + (ht – Math.floor(max5)) + ‘” y2=”‘ + (ht – Math.floor(max5)) + ‘” stroke-linecap=”round” stroke=”red” />’;
document.getElementById(“svg1″).innerHTML += ‘<line stroke-width=”1” x1 = “‘ + xold + ‘” x2 = “‘ + (wdth*(i + 1)) + ‘” y1=”‘ + (ht – Math.floor(max6)) + ‘” y2=”‘ + (ht – Math.floor(max6)) + ‘” stroke-linecap=”round” stroke=”red” />’;
document.getElementById(“svg1″).innerHTML += ‘<line stroke-width=”2” x1 = “‘ + xold + ‘” x2 = “‘ + (wdth*(i + 1)) + ‘” y1=”‘ + yold + ‘” y2=”‘ + (ht – Math.floor(max3)) + ‘” stroke-linecap=”round” stroke=”‘ + fil + ‘” />’;
document.getElementById(“svg1″).innerHTML += ‘<ellipse cx=”‘ + (wdth*(i + 1)) + ‘” cy=”‘ + (ht – Math.floor(max3)) + ‘” rx=”5″ ry=”5″ style = “fill: ‘ + fil + ‘” /> ‘;
document.getElementById(“svg1″).innerHTML += ‘<line stroke-width=”2” x1 = “‘ + xold + ‘” x2 = “‘ + (wdth*(i + 1)) + ‘” y1=”‘ + (ht – Math.floor(max4)) + ‘” y2=”‘ + (ht – Math.floor(max4)) + ‘” stroke-linecap=”round” stroke=”‘ + fil + ‘” />’;
}
yold = ht – Math.floor(max3);
xold = (wdth*(i + 1));
}

Additionally, the following displays the mean and standard deviation at the bottom of the graph:
var txtstr = “Mean ” + meanval.toFixed(3) + ” Std Dev ” + dev2.toFixed(3);
document.getElementById(“svg1″).innerHTML += ‘<text x=”500″ y=”650″ fill=”blue” font-size=”28″ font-family=”Arial” stroke=”blue” stroke-width=”0″ >’ + txtstr + ‘</text>’;