Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/09/2006, 15:42
safe
 
Fecha de Ingreso: enero-2003
Ubicación: Córdoba, Argentina
Mensajes: 1.047
Antigüedad: 22 años
Puntos: 10
Bueno, mucho del tema que estas hablando no conosco.... de hecho no se que significa φ(fi), pero si no es un calculo y el numero ese sepone directamente por el input FI esto deberia funcionar.

Código:
<html>
<title> Potencia </title>
<head>
<script languaje="javascript">
<!--
function calcular(que)
{
	var V  = parseInt(document.getElementById('V').value);
	var I  = parseInt(document.getElementById('I').value);
	var FI = parseInt(document.getElementById('FI').value);
	var res;
	
	switch(que)
	{
		case 'S': res = V * I;
				  break;

		case 'P': res = V * I * Math.cos(FI);
	   			  break;

		case 'Q': res = V * I * Math.sin(FI);
				  break;
	}
	
	document.getElementById('R').value = res;
}
//-->
</script>
</head>

<body>
<center><font size=7 Face="Comic Sanz MS"> "Potencia" </font><br><br>

<form name="a">
<table border="2">
<tr>
<td>
<input type="text" name="V" id="V">V<br>
<input type="text" name="I" id="I">I<br>
<input type="text" name="FI" id="FI">Fi<br>
<input type="button" name="s" value="calcular s" onClick="calcular('S')">
<input type="button" name="p" value="calcular p" onClick="calcular('P')">
<input type="button" name="q" value="calcular q" onClick="calcular('Q')">
<input type="reset" value="Reset" name="r">
</td>
<td>
<textarea name="R" id="R" Rows="10" Cols="50"></textarea>
</td>
</tr>
</table>
</form>

</body>
</html>
__________________
oohh... quisiera ser godines!!!