Добавлю свои 5коп...
<!DOCTYPE html>
<html>
<head>
<!--
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" type="text/css" href="tmp.css" />
-->
<style type="text/css">
label {
display: block;
}
</style>
<script type="text/javascript">
function ww() {
var oi=document.getElementById('fld').getElementsByTagName('input');
var val=0
for (var i=0; i<oi.length; i++) {
val+=+oi[i].value;
};
val=val/oi.length;
document.getElementById('d').value=val;
}
</script>
</head>
<body>
<form>
<p>Среднее арифметическое</p>
<div id='fld'>
<label>x1=<input type="text" id='a' size='4'></label>
<label>x2=<input type="text" id='b' size='4'></label>
<label>x3=<input type="text" id='c' size='4'></label>
</div>
<div>
<input type="button" value="Нажми" onclick="try{ ww() } catch(e) {alert(e)}">
</div>
<label>y=<input type="text" id='d' size='4'></label>
</form>
</body>
</html>