Changes

From Fellrnr.com, Running tips
Jump to: navigation, search

Test

3,431 bytes added, 23:13, 22 February 2012
Created page with "<html> <script type="text/javascript"> var isArray = function (obj) { return Object.prototype.toString.call(obj) === "[object Array]"; }, getNumWithSetDec = function( num, numOf..."
<html>
<script type="text/javascript">
var isArray = function (obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
},
getNumWithSetDec = function( num, numOfDec ){
var pow10s = Math.pow( 10, numOfDec || 0 );
return ( numOfDec ) ? Math.round( pow10s * num ) / pow10s : num;
},
getAverageFromNumArr = function( numArr, numOfDec ){
if( !isArray( numArr ) ){ return false; }
var i = numArr.length,
sum = 0;
while( i-- ){
sum += numArr[ i ];
}
return getNumWithSetDec( (sum / numArr.length ), numOfDec );
},
getVariance = function( numArr, numOfDec ){
if( !isArray(numArr) ){ return false; }
var avg = getAverageFromNumArr( numArr, numOfDec ),
i = numArr.length,
v = 0;

while( i-- ){
v += Math.pow( (numArr[ i ] - avg), 2 );
}
v /= numArr.length;
return getNumWithSetDec( v, numOfDec );
},
getStandardDeviation = function( numArr, numOfDec ){
if( !isArray(numArr) ){ return false; }
var stdDev = Math.sqrt( getVariance( numArr, numOfDec ) );
return getNumWithSetDec( stdDev, numOfDec );
};

function doCalc()
{
Monotony.trimp_1.value = Monotony.Dur_1.value * Monotony.cr10_1.value;
}
</script>

<form name="Monotony">
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<th>Day</th>
<th>Duration (min)</th>
<th>CR10 Rating</th>
<th>TRIMP(CR10)</th>
</tr>
<tr>
<td>1</td>
<td><input maxlength="3" size="3" name="Dur_1" value="0"></td>
<td><input maxlength="3" size="3" name="cr10_1" value="0"></td>
<td><input maxlength="3" size="3" name="trimp_1" value="0" readonly="readonly"></td>
</tr>
<tr>
<td>2</td>
<td><input maxlength="3" size="3" name="Dur_2" value="0"></td>
<td><input maxlength="3" size="3" name="cr10_2" value="0"></td>
<td><input maxlength="3" size="3" name="trimp_2" value="0" readonly="readonly"></td>
</tr>
<tr>
<td>3</td>
<td><input maxlength="3" size="3" name="Dur_3" value="0"></td>
<td><input maxlength="3" size="3" name="cr10_3" value="0"></td>
<td><input maxlength="3" size="3" name="trimp_3" value="0" readonly="readonly"></td>
</tr>
<tr>
<td>4</td>
<td><input maxlength="3" size="3" name="Dur_4" value="0"></td>
<td><input maxlength="3" size="3" name="cr10_4" value="0"></td>
<td><input maxlength="3" size="3" name="trimp_4" value="0" readonly="readonly"></td>
</tr>
<tr>
<td>5</td>
<td><input maxlength="3" size="3" name="Dur_5" value="0"></td>
<td><input maxlength="3" size="3" name="cr10_5" value="0"></td>
<td><input maxlength="3" size="3" name="trimp_5" value="0" readonly="readonly"></td>
</tr>
<tr>
<td>6</td>
<td><input maxlength="3" size="3" name="Dur_6" value="0"></td>
<td><input maxlength="3" size="3" name="cr10_6" value="0"></td>
<td><input maxlength="3" size="3" name="trimp_6" value="0" readonly="readonly"></td>
</tr>
<tr>
<td>7</td>
<td><input maxlength="3" size="3" name="Dur_7" value="0"></td>
<td><input maxlength="3" size="3" name="cr10_7" value="0"></td>
<td><input maxlength="3" size="3" name="trimp_7" value="0" readonly="readonly"></td>
</tr>
</table>
<label name="Monotony">Monotony:</label>
<br>
<input type="button" value="Calculate" OnClick="doCalc();"/>
</form>
</html>

Navigation menu