HTML - Eliminar campos en un conversor

   
Vista:

Eliminar campos en un conversor

Publicado por Feliciano b2796835@trbvn.com (1 intervención) el 04/04/2016 03:34:13
Hola a todos, actualmente necesito ayuda con un conversor de unidades para mi blog de cocina.
Se puede ver en esta página: http://oldxn.blogspot.com.ar/2016/03/conversor-mejorado.html
Quisiera sacarle todo el código que corresponde a las unidades tsp, tbsp y cups en volumen.
Me gustaría saber si depende de algún documento externo o no tengo que preocuparme por eso, ya que lo he encontrado en un sitio que no conocía.
Desde ya, mil gracias.

Dejo el código en HTML aquí

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<table align="center"><tr><td><br />
<script language="JavaScript">
function convertform(form){
    var firstvalue = 0;
    for (var i = 1; i <= form.count; i++) {
 
       if (form.elements[i].value != null && form.elements[i].value.length != 0) {
   if (i == 1 && form.elements[2].value != "") return false;
   firstvalue = form.elements[i].value / form.elements[i].factor;
   break;
       }
    }
    if (firstvalue == 0) {
       clearform(form);
       return false;
    }
    for (var i = 1; i <= form.count; i++)
       form.elements[i].value = formatvalue((firstvalue * form.elements[i].factor), form.rsize);
    return true;
}
function converttempform(form){
    var firstvalue = 0;
 
     if (form.elements[1].value != null && form.elements[1].value.length != 0) {
   form.elements[2].value = (Math.round((100/(212-32) * (form.elements[1].value - 32))*100))/100;
   return true;
    }
 
     if (form.elements[2].value != null && form.elements[2].value.length != 0) {
   form.elements[1].value = (Math.round(((212-32)/100 * form.elements[2].value + 32)*100))/100;
   return true;
    }
}
function formatvalue(input, rsize) {
   var invalid = "**************************";
   var nines = "999999999999999999999999";
   var strin = "" + input;
   var fltin = parseFloat(strin);
   if (strin.length <= rsize) return strin;
   if (strin.indexOf("e") != -1 ||
       fltin > parseFloat(nines.substring(0,rsize)+".4"))
      return invalid.substring(0, rsize);
   var rounded = "" + (fltin + (fltin - parseFloat(strin.substring(0, rsize))));
   return rounded.substring(0, rsize);
}
function resetform(form) {
    clearform(form);
    form.elements[1].value = 1;
    convertform(form);
    return true;
}
function resettempform(form) {
    cleartempform(form);
    form.elements[1].value = 212;
    converttempform(form);
    return true;
}
function clearform(form) {
    for (var i = 1; i <= form.count; i++) form.elements[i].value = "";
    return true;
}
function cleartempform(form) {
    for (var i = 1; i <= form.count; i++) form.elements[i].value = "";
    return true;
}
</script>
 
<p style="font-size:12pt;">
<font face="Verdana, Verdana" color="#6f3c1b">Conversor de medidas de volumen</font></p><form>
 
    <table align="center" border="0" class="converter">
<tr>
 
        <th><font color="#6f3c1b">tsp</font></th>
        <th><font color="#6f3c1b">tbsp</font></th>
        <th><font color="#6f3c1b">cups</font></th>
  <th><font color="#6f3c1b">fl oz</font> </th>
        <th><font color="#6f3c1b">ml</font></th>
  <th><font color="#6f3c1b">l</font></th>
        <td><input type="button" value="Calibrate" onclick="resetform(this.form)" style="DISPLAY: none"><font color="#6f3c1b"></font></td>
      </tr>
<tr>
        <td><input size="5" name="val1" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>
        <td><input size="5" name="val2" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>
        <td><input size="5" name="val3" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>
        <td><input size="5" name="val4" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>
        <td><input size="5" name="val5" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>
        <td><input size="5" name="val6" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>
        <td><input type="button" class="botonconversor" value="Calcular" onclick="convertform(this.form)"><font color="#6f3c1b"></font></td>
      </tr>
</table></form><script language="JavaScript">
document.forms[0].count = 6;
document.forms[0].rsize = 5;
 
document.forms[0].val1.factor = 0.2028841; // ml a tsp
document.forms[0].val2.factor = 0.06762805; // ml a tbsp
document.forms[0].val3.factor = 0.004226753; // ml a cups
document.forms[0].val4.factor = 0.03381402; // ml a oz
document.forms[0].val5.factor = 1; // ml a ml
document.forms[0].val6.factor = 0.001; // ml a l
<!-- done hiding from old browsers -->
</script><br />
<br />
<br />
<p style="font-size:12pt;"><font face="Verdana, Verdana, Verdana" color="#6f3c1b">Conversor de medidas de peso</font></p><br />
<form><table align="center" border="0" class="converter"><tr>         <th><font color="#6f3c1b">oz</font></th>         <th><font color="#6f3c1b">lb</font></th>         <th><font color="#6f3c1b">g</font></th>         <th><font color="#6f3c1b">kg</font></th>         <td><input type="button" value="Calibrate" onclick="resetform(this.form)" style="DISPLAY: none"><font color="#6f3c1b"></font></td>       </tr>
<tr>         <td><input size="5" name="val1" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>         <td><input size="5" name="val2" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>         <td><input size="5" name="val3" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>         <td><input size="5" name="val4" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>         <td><input type="button" class="botonconversor" value="Calcular" onclick="convertform(this.form)"><font color="#6f3c1b"></font></td>       </tr>
</table></form><br />
<script language="JavaScript">
 
document.forms[1].count = 4;
document.forms[1].rsize = 5;
document.forms[1].val1.factor = 1;
document.forms[1].val2.factor = .0625;
document.forms[1].val3.factor = 28.349523;
document.forms[1].val4.factor = .028349523;
<!-- done hiding from old browsers -->
</script><br />
<br />
<p style="font-size:12pt;"><font face="Verdana, Verdana" color="#6f3c1b">Conversor de medidas de longitud</font></p><br />
<form><table align="center" border="0" class="converter"><tr>         <th><font color="#6f3c1b">mm</font></th>         <th><font color="#6f3c1b">cm</font></th>         <th><font color="#6f3c1b">in</font></th>         <td><input type="button" value="Calibrate" onclick="resetform(this.form)" style="DISPLAY: none"><font color="#6f3c1b"></font></td>       </tr>
<tr>         <td><input size="5" name="val1" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>         <td><input size="5" name="val2" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>         <td><input size="5" name="val3" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>         <td><input size="5" type="button" class="botonconversor" value="Calcular" onclick="convertform(this.form)"><font color="#6f3c1b"></font></td>       </tr>
</table></form><br />
<script language="JavaScript">
<!-- done hiding from old browsers -->
document.forms[2].count = 3;
document.forms[2].rsize = 5;
document.forms[2].val1.factor = 1; // mm a mm
document.forms[2].val2.factor = .10; //mm a cm
document.forms[2].val3.factor = .03937007874; //mm a in
</script><br />
<br />
<p style="font-size:12pt;"><font face="Verdana, Verdana" color="#6f3c1b">Conversor de temperatura</font></p><br />
<br />
<form><table align="center" border="0" class="converter"><tr>         <th><font color="#6f3c1b">&#176; F</font> </th>         <th><font color="#6f3c1b">&#176; C</font> </th>         <td><input type="button" value="Calibrate" onclick="resettempform(this.form)" style="DISPLAY: none"><font color="#6f3c1b"></font></td>       </tr>
<tr>         <td><input size="5" name="val1" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>         <td><input size="5" name="val2" class="converterBox" onfocus="clearform(this.form)"><font color="#6f3c1b"></font></td>         <td><input type="button" class="botonconversor" value="Calcular" onclick="converttempform(this.form)"><font color="#6f3c1b"></font></td>       </tr>
</table></form><script language="JavaScript">
 
document.forms[3].count = 2;
document.forms[3].rsize = 5;
<!-- done hiding from old browsers -->
</script><br />
</td></tr>
</table><br />
<div id="cups"></div>
 
<style>
.botonconversor {
background:#00F5D2;
border: 1px solid #00F5D2;
color: white;
cursor: pointer;
font-family: 'Arial', sans-serif !important;
color: #fff;
cursor: pointer;
line-height: 19px;
padding: 8px 10px;
text-decoration: none;
outline: none;
}
 
.botonconversor:hover {
background:#FCC6CF;
border:1px solid #FCC6CF; 
}
</style>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder