Hi,
If someone can help me, Id really appreciate it. The task is to input numbers (seperated by commas) into a textarea and then when the user clicks "plot" the mean and standard deviation appear in the appropriate textareas. In addition, a histogram is constructed from the numbers in the array. I have some code but it does not seem to work.
Can someone give me some tips. I am new at all this stuff.
<html>
<title>
David's Computer Program
</title>
<head>
<script>
var A = new Array();
var freq = new Array();
var A = s.split(",");
var mean;
var sum=0;
A = document.davidForm.main1.value.split(",");
function clearMainScreen() {
window.document.david.main1.value = "";
}
fucntion displayAvg() {
var mean = document.davidForm.main1.value;
for (var i = 0; i = A.length-1; i++) {
A[i] = parseInt(A[i]);
sum = sum + A[i];
}
mean = (sum / A.length);
window.alert("mean");
}
function standardDeviation (){
var smsq = sum+sum
var stdr = Math.sqrt((smsq-smsq/A.length)/A.length-1))
for (var i=0; i<A.length; i++){
sum=sum+A[i]
smsq+(A[i]*A[i])
var largest=freq[0]
for (var i=0; i<freq.length; i++){
document.images[i].width=30;
document.images[i]height=Math.floor(freq[i]*unit)
for (var i=0; i<freq.length; i++){
if (largest<freq[i]{
largest=freq[i]
}
}
for (var i=0; i<A.length; i++){
if(A[i}>=0 && A{i} <=9{
freq[0]=freq[0]+1
}
}
var bin = Math.floor(A[i]/10);
freq[bin] = freq[bin]+1
Math.random
for (var i=0; i<A.length; i++){
A[i]=Math.round(Math.round( )*100)
}
</script>
</head>
<body bgcolor="aqua">
<form name=david>
<table cellpadding=5>
<tr>
<td> <h2>Welcome to David's Amazing Webpage</h2> </td>
</tr>
<tr>
<td> <textarea rows=10 cols=50 name=main1></textarea> </td>
</tr>
<tr>
<td>
<input type="button" name="plot" value="Plot" onClick="displayAvg();">
<input type="button" name="fill" value="Fill" onClick="fillRandom();">
<input type="text" name=filler>
<input type="button" value="Clear" onClick="clearMainScreen();"></td>
</tr>
<tr>
<td>
<img src=b.jpg height=1 width=40>
<img src=b.jpg height=1 width=40>
<img src=b.jpg height=1 width=40>
<img src=b.jpg height=1 width=40>
<img src=b.jpg height=1 width=40>
<img src=b.jpg height=1 width=40>
<img src=b.jpg height=1 width=40>
<img src=b.jpg height=1 width=40>
<img src=b.jpg height=1 width=40>
<img src=b.jpg height=1 width=40>
</td>
</tr>
<tr>
<td> Mean <input type="text" name="mean"> <br>
Standard Deviation <input type="text" name"sd">
</td>
</tr>
</table>
</form>
</body>
</html>