Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/08/2012, 23:14
jeremiselxi
(Desactivado)
 
Fecha de Ingreso: septiembre-2008
Mensajes: 269
Antigüedad: 15 años, 7 meses
Puntos: 22
Obtener y cambiar el valor en una tabla

Buenas amigos y Dios los bendiga.

Tengo la siguiente situacion: yo trabajo en una empresa donde se instalan GPS a los vehiculos y por medio de una pagina, le mide el combustible, pero que pasa, la mide mal. Entonces, yo tengo la solucion, pero no lo podido lograr. Este es el trozo de codigo de la pagina

Código HTML:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> 
<p>obtener la distancia en este input:
  <input type="text" id="distancia" value="">
</p>
<p>aqui introducir la cantidad de kilometros por galon:
  <input type="text" id="cantidad" value="">
</p>
<p><br>
  Division de la distancia / cantidad de kilometros por galon
  <input type="text" id="division" value="">
  <br>
  <input type="button"  id="calcular" value="calcular">
  
  
  </script>
</p>
<table><tbody><tr><td><span style="font-size:14px; font-weight:bold">Reporte de Combustible:</span>&nbsp;&nbsp;</td></tr><tr><td><form method="get" action="/fuel_report.php" name="form1"><table cellpadding="5" bgcolor="#f5f5f5" style="margin-top:5px; margin-bottom:5px"><tbody><tr><td style=""><span style="margin:3px;">
					<script>
						function lookup_id(value)
						{
							if (value == "")
							{
								return;
							}
							value = value.toUpperCase();
							var obj = document.getElementById("r_uin");
							for (var i = 0; i &lt; obj.options.length; i++)
							{
								if (obj.options[i].text.toUpperCase().indexOf(value) != -1)
								{
									// alert(obj.options(i).text);
									obj.selectedIndex = i;
									return;
								}
							}
						}
					</script>
					ID Vehiculo:&nbsp;<select style="width:150" id="r_uin" name="r_uin"><option value="">Ninguno</option><optgroup label="admin"><option value="8613570004900">AdminTracker - 8613570004900 - AS300</option></optgroup><optgroup label="CARLOS"><option value="3793112">Carlos - 3793112 - AS600</option></optgroup><optgroup label="dppolancog"><option value="3796001">Hiundai Tucson 2007 - 3796001 - AS600</option></optgroup><optgroup label="Hatoreycompany"><option value="3792012">HRC Ficha F-201 - 3792012 - AS600</option></optgroup><optgroup label="Jhonatan"><option value="379260612039531">AS31 - 379260612039531 - AS300</option><option value="379260612039532">AS32 - 379260612039532 - AS300</option><option value="379260612039533">AS33 - 379260612039533 - AS300</option><option value="379260612039534">AS34 - 379260612039534 - AS300</option><option value="379260612039563">AS63 - 379260612039563 - AS600</option><option value="379260612039564">AS64 - 379260612039564 - AS600</option><option value="379260612039565">AS65 - 379260612039565 - AS600</option><option value="3791987">pruebatramigo - 3791987 - AS600</option></optgroup><optgroup label="Ruben"><option value="3796002">Jeep Ruben - 3796002 - AS600</option></optgroup><optgroup label="SONORAMA"><option selected="" value="3793997280">Sonorama Ficha 13 - 3793997280 - AS600</option></optgroup></select> Buscar: <input onkeyup="lookup_id(this.value);" size="6" name="r_uin_input" id="r_uin_input"></span><span style="margin:3px;">Desde:&nbsp;<input type="text" onpropertychange="" onclick="calendar.show(this);" maxlength="50" readonly="readonly" style="width:63px;" value="2012-08-22" id="r_from_date" name="r_from_date">&nbsp;H:<input type="text" onblur="check_min('from_H')" maxlength="2" style="width:16px;" size="2" value="00" id="r_from_H" name="r_from_H">&nbsp;M:<input type="text" onblur="check_sec('from_M')" maxlength="2" style="width:16px;" size="2" value="00" id="r_from_M" name="r_from_M"></span><span style="margin:3px;">Hasta:&nbsp;<input type="text" onpropertychange="" onclick="calendar.show(this);" maxlength="50" readonly="readonly" style="width:63px;" value="2012-08-29" id="r_to_date" name="r_to_date">&nbsp;H:<input type="text" onblur="check_min('r_to_H')" maxlength="2" style="width:16px;" size="2" value="23" id="r_to_H" name="r_to_H">&nbsp;M:<input type="text" onblur="check_sec('r_to_M')" maxlength="2" style="width:16px;" size="2" value="59" id="r_to_M" name="r_to_M"></span><span style="margin:3px;"><div style="height:3px"></div><span style="margin:3px;">Condición grupal:&nbsp;<select style="width:60" id="r_group" name="r_group"><option selected="" value="0">Day</option><option value="1">Week</option><option value="2">Month</option></select></span><span style="margin:3px;">Datos:&nbsp;<select style="width:120" id="r_ignore_data" name="r_ignore_data"><option value="0">Ignorar Apagado ACC</option><option selected="" value="1">Todos los datos</option></select></span><input type="submit" value="Buscar" class="buttonSkinA" name="r_search">&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="Guardar a archivo" onclick="document.getElementById('write_to_files').style.display='block';this.disabled=true;" class="buttonSkinB" name="r_save_to_file">&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="Obtener todas las direcciones" onclick="update_all_address()" class="buttonSkinB" name="r_get_all_address"></span></td></tr><tr><td align="right" colspan="7"><div style="display:none;" name="write_to_files" id="write_to_files"><input type="submit" value="Guardar como HTML" class="buttonSkinB" name="r_save_to_html">&nbsp;<input type="submit" value="Guardar en Excel" class="buttonSkinB" name="r_save_to_excel">&nbsp;<input type="submit" value="Guardar en PDF" class="buttonSkinB" name="r_save_to_pdf">&nbsp;<input type="submit" value="Guardar como CSV" class="buttonSkinB" name="r_save_to_csv">&nbsp;</div></td></tr></tbody></table></form></td></tr><tr><td><div name="_r_body" id="_r_body"><table cellspacing="0" cellpadding="4" border="1" class="tableBorder"><tbody><tr><th width="80">ID Vehiculo</th><th width="120">Desde:</th><th width="120">Hasta:</th><th width="550">Combustible</th><th width="40">Distancia:</th><th width="40">inicio de Odometro</th><th width="40">fin de Odometro</th></tr><tr style=""><td>Sonorama Ficha 13</td><td>2012-08-28 10:20:34</td><td>2012-08-28 22:35:36</td><td>Used: 1221.05 Galones; Add Times: 2; Add Total: 1169.16 Galones; Comsumo de combustible: 5,193.3 Galones/100KM</td><td>23.51</td><td>90.8</td><td>110.0</td></tr></tbody></table></div></td></tr><tr><td bgcolor="#f8f8f8" width="100%"><table cellspacing="0" cellpadding="6" border="0"><tbody><tr><th width="80" style="text-align:right">Total:</th><td width="800" colspan="7">1 Registro(s)</td></tr><tr><th width="120" style="text-align:right">Distancia total::</th><td width="80" colspan="7">23.5 KM</td></tr><tr><th width="80" style="text-align:right">Combustible utilizado:</th><td width="80" colspan="1">1221.05 Galones</td><th width="80" style="text-align:right">Añadir tiempos gasolina:</th><td width="80" colspan="1">2</td><th width="80" style="text-align:right">Añadir Combustible:</th><td width="80" colspan="1">1169.16 Galones</td><th width="120" style="text-align:right">Comsumo de combustible:</th><td width="80" colspan="1">5,193.3Galones (100KM)</td></tr><tr><th width="50" style="text-align:right">Alarma:</th><td width="800" colspan="7">Alarma! alta velocidad x 2</td></tr></tbody></table></td></tr></tbody></table> 

Cual es la problematica? que quisiera saber como obtengo el valor 23.51 que esta abajo de donde dice distancia.

ese valor, si es posible capturarlo en un text llamado distancia que esta al principio.

luego yo introducir un valor en el text que dice kilometros por galon por ejemplo 10,

indicando que por cada 10 kilometros, el carro me gastara 1 galon, entonces, hacer un calculo, que divida ambos text y lo ponga en tercer text que diga, division. y al darle al boton, que el resultado que me en ese text, me lo cambie en donde dice

Combustible utilizado:1221.05 Galones, por el valor que me de.


Esto no es complicado, para el que se sabe.

si me pudieran ayudar, se los agradeceria, o por lo menos, le agradeceria, que me dijeran como obtengo en un text un valor que esta dentro de una tabla.