<form name="form1">
<input type="text" onclick="this.style.backgroundColor = 'white';" name="visota" /><br/>
<input type="text" onclick="this.style.backgroundColor = 'white';" name="shirina" /><br/>
<input type="button" onclick="raschet(this.form)" value="Перемножить" /><br/>
<input type="text" name="res_metall" />
</form>
<script>
function raschet(form){
var visota = form[0], shirina = form[1],
error;
if(isNaN(visota.value)) {
visota.style.backgroundColor = 'red';
error = true;
}
if(isNaN(shirina.value)) {
shirina.style.backgroundColor = 'red';
error = true;
}
if(error == true) return NaN;
s = visota.value * shirina.value;
form[3].value=s;
return s;
}
</script>