Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/07/2007, 23:25
ccodrian
 
Fecha de Ingreso: julio-2007
Mensajes: 1
Antigüedad: 17 años, 9 meses
Puntos: 0
Problemas con codigo de Cotizacion online

Hola a todos !!

Tengo un problemita con un codigo simple que se supone me deberia calcular una cotizacion automaticamente segun los datos que ingresa el cliente.

Código HTML:
<html>
<head> 
<script language="JavaScript">
	function getQuotation(){
		
		age=document.getElementById('age').value;
		//pickup=document.getElementById('pickup').value;
		return=document.getElementById('return').value;
		days=document.getElementById('days').value;
		total=0;
		rate=0;

		document.getElementById('admFee').innerHTML='0';

		if(return=='Brisbane Airport'){
			document.getElementById('airFee').innerHTML='30';
			total=total+30;
		}
		else{
			document.getElementById('airFee').innerHTML='0';
		}

		rate=113-days;
		rate=rate/0.8;
		rate=days*rate;
		document.getElementById('carRental').innerHTML=rate;
		total=total+rate;

		document.getElementById('total').innerHTML=total;
	}
</script>

</head>
<body>

<form>
	<b>Driver's Age</b><br> 
		<input type="text" id='age'>
	<br><b>Pick-Up</b><br> 
		<select id='pickup'>
			<option>4WD Rent a Car Brisbane Office</option>
			<option>Brisbane Airport</option>
		</select>
	<br><b>Return</b><br> 				
		<select id='return'>
			<option>4WD Rent a Car Brisbane Office</option>
			<option>Brisbane Airport</option>
		</select>
	<br><b>How many days?</b><br> 
		<input type="text" id='days' size="3">
	<br><b>E-mail Address</b><br> 
		<input type="text" id='email' size="15">
		
		<br><br><input type="button" value="Get Quotation" onClick="getQuotation()"> 
</form>

<p>
<font color="#ff6600"><b>Your quotation</b></font>
</p>
<table border="0" cellspacing="0" cellpadding="0">
	<tbody>
		<tr>
			<td><font face="arial,helvetica,sans-serif" size="1"><b>&nbsp;Car Rental:&nbsp;<br />
			</b></font> </td>
			<td><font face="arial,helvetica,sans-serif" size="1">$&nbsp;</font></td>
			<td id='carRental' align="right"><font face="arial,helvetica,sans-serif" size="1">&nbsp;</font></td>
		</tr>
		<tr>
			<td><font face="arial,helvetica,sans-serif" size="1"><b>&nbsp;Administration Fee: <br />
			</b></font></td>
			<td><font face="arial,helvetica,sans-serif" size="1">$<br />
			</font></td>
			<td id='admFee' align="right"><font face="arial,helvetica,sans-serif" size="1">&nbsp;</font></td>
		</tr>
		<tr>
			<td><font face="arial,helvetica,sans-serif" size="1"><b>&nbsp;Airport Fee:<br />
			</b></font></td>
			<td><font face="arial,helvetica,sans-serif" size="1">$<br />
			</font></td>
			<td id='airFee' align="right"><font face="arial,helvetica,sans-serif" size="1">&nbsp;</font></td>
		</tr>
		<tr>
			<td><font face="arial,helvetica,sans-serif" size="1"><b>&nbsp;Other Fees (please refer to our rental agrement): <br />
			</b></font></td>
			<td><font face="arial,helvetica,sans-serif" size="1">$<br />
			</font></td>
			<td id='otherFee' align="right"><font face="arial,helvetica,sans-serif" size="1">&nbsp;</font></td>
		</tr>
		<tr>
			<td><font color="#ff6600" face="arial,helvetica,sans-serif" size="1">&nbsp;Total:</font></td>
			<td><font color="#ff6600" face="arial,helvetica,sans-serif" size="1">$<br />
			</font></td>
			<td id='total' align="right"><font color="#ff6600" face="arial,helvetica,sans-serif" size="1">&nbsp;</font></td>
		</tr>
	</tbody>
</table>

</body>
</html> 
Por alguna razon que no consigo resolver, el boton de "Get Quotation" no me llama a la funcion JavaScript. Probe cambaindo esta funcion por otra mas simple (una que cambiara el color de fondo por ejemplo), pero igual no pasa nada. Ojala me puedan ayudar, gracias por adelantado.