- This topic has 3 replies, 2 voices, and was last updated 11 years, 2 months ago by support-octavio.
-
AuthorPosts
-
mike1947MemberHello have written java script list box script into html works in the test center but not on phone any ideas ?
Please Mike<SCRIPT LANGUAGE=”JavaScript”>
<!– Begin
function doField(form) {
distance = (form.distance.value)*1000;
CoC = (document.form.format.options[document.form.format.selectedIndex].value);
aperture = (document.form.aperture.options[document.form.aperture.selectedIndex].value);
focal = (document.form.focal.options[document.form.focal.selectedIndex].value);
if (isNaN(distance)) {
alert(‘Please enter a numerical value for subject distance.’);
document.form.distance.focus();
document.form.distance.select();
}
else {
hyperFocal = (focal * focal) / (aperture * CoC);
form.hyperFocal.value = Math.round(hyperFocal) / 1000 + ” m”;
dofNear = (hyperFocal * distance) / (hyperFocal + (distance – focal));
form.dofNear.value = Math.round(dofNear) / 1000 + ” m”;
dofFar = (hyperFocal * distance) / (hyperFocal – (distance – focal));
if (dofFar < 0) {
form.dofFar.value = “Infinity.”;
}
else {
form.dofFar.value = Math.round(dofFar)/1000+” m”;
}
dofTotal = Math.round(dofFar – dofNear);
if (dofTotal < 0) {
form.dofTotal.value = “Infinite.”;
}
else {
if (dofTotal >= 0 && dofTotal < 0.001) {
form.dofTotal.value = “>1 mm “;
}
else {
form.dofTotal.value = dofTotal / 1000 + ” m”;
}
}
}
}
// End –>
</script><form method=post name=form>
<table border=3 cellpadding=3 cellspacing=0 width=250 style=”border-collapse: collapse” bordercolor=”#111111″>
<tr>
</tr>
<tr>
<td align=left>
Negative Format
</td>
<td align=left>
<select name=format>
<option value=0.033>35 mm</option>
<option value=0.025>APS</option>
<option value=0.05>6×45 cm</option>
<option value=0.06>6×6 cm</option>
<option value=0.065>6×7 cm</option>
<option value=0.15>5×4 inch</option>
<option value=0.3>10×8 inch</option>
</select>
</td>
</tr>
<tr>
<td align=left>
Lens focal length
</td>
<td align=left>
<select name=focal>
<option value=17>17 mm</option>
<option value=20>20 mm</option>
<option value=24>24 mm</option>
<option value=28>28 mm</option>
<option value=35>35 mm</option>
<option value=50>50 mm </option>
<option value=70>70 mm</option>
<option value=80>80 mm</option>
<option value=100>100 mm</option>
<option value=135>135 mm</option>
<option value=150>150 mm</option>
<option value=200>200 mm</option>
<option value=210>210 mm</option>
<option value=300>300 mm</option>
<option value=350>350 mm</option>
<option value=400>400 mm</option>
</select>
</td>
</tr>
<tr>
<td align=left>
Selected aperture
</td>
<td align=left>
<select name=aperture>
<option value=1.4>F 1.4</option>
<option value=1.8>F 1.8</option>
<option value=2>F 2</option>
<option value=2.8>F 2.8</option>
<option value=4>F 4</option>
<option value=5.6>F 5.6</option>
<option value=8> F 8</option>
<option value=11>F 11</option>
<option value=16>F 16</option>
<option value=22>F 22</option>
<option value=32>F 32</option>
<option value=45>F 45</option>
<option value=64>F 64</option>
<option value=90>F 90</option>
</select>
</td>
</tr>
<tr>
<td align=left>
Subject distance (Meters)
</td>
<td align=left>
<input type=text name=distance value=”” size=6>
</td>
</tr>
<tr>
<td colspan=2 align=left>
<br>
<center><input type=button value=”Calculate.” onclick=”doField(this.form)”></center>
<p>
<input name=hyperFocal type=text value=”” size=6> Hyperfocal distance for this lens/aperture combination.
<BR>
<input name=dofNear type=text value=”” size=6> Near limit of acceptable sharpness.
<BR>
<input name=dofFar type=text value=”” size=6> Far limit of acceptable sharpness.
<BR>
<input name=dofTotal type=text value=”” size=6> Total depth of field.
<br>
</td></tr>
</table>
</form>
support-octavioMemberIt seems like a problem we have reviewed before. Please try to add the class=”m1-iscroll-no-prevent-default” to <select> element to allow the comboboxes working. Hope this is helpful. Let me know how it goes for you.
mike1947MemberHi thanks for the prompt reply, do I add this as follows into the raw java script eg <option value=0.3>10×8 inch</option>
class=”m1-iscroll-no-prevent-default”</select>or use view source in the test center and adjust from there.
Mike
support-octavioMemberHi Mike,
The code I provided you should be within the <select> tag. Example:
<select name=format class=”m1-iscroll-no-prevent-default”>
-
AuthorPosts