Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/07/2008, 16:17
Avatar de Un_Tico
Un_Tico
 
Fecha de Ingreso: julio-2008
Ubicación: Cartago, Costa Rica
Mensajes: 176
Antigüedad: 15 años, 9 meses
Puntos: 4
Respuesta: no se hacer multiplicacion

Mmmmm... es algo muy simple y deberías intentarlo un poco más pero me gusta ayudar

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prueba</title>
<script type="text/javascript">
function multiplica(){
	if(document.getElementById('cantidad1') && document.getElementById('cantidad2')){
		if( !isNaN(document.getElementById('cantidad1').value) && document.getElementById('cantidad1').value!='' ){
			if( !isNaN(document.getElementById('cantidad2').value) && document.getElementById('cantidad2').value!=''){
				var cant1= parseInt(document.getElementById('cantidad1').value);
				var cant2= parseInt(document.getElementById('cantidad2').value);
				var resultado=cant1*cant2
				document.getElementById('resultado').value=resultado;
			}else{
				alert('Has ingresado un numero no válido en la segunda cantidad');
			}
		}else{
			alert('Has ingresado un numero no válido en la primera cantidad');
		}
	}
}
</script>
</head>
<body>

<input type="text" name="cantidad1" id="cantidad1">
*
<input type="text" name="cantidad2" id="cantidad2">
<input type="button" name="button" id="button" value="Igual" onclick="multiplica()">
<input type="text" name="resultado" id="resultado">

</body>
</html>
espero que te sirva...