在我的HTML表单中,我有一个只读字段,其中包含基于各种选择和广播框的费用。
<input name="AdultFee_1" type="text" class="tabfont_right" id="AdultFee_1" value="0" size="10" readonly="readonly" />
以下javascript(简称缩写)用于分配费用并在AdultFee_1中显示。
function GetField (FieldID)
{
return document.getElementById(FieldID);
} //endfunction GetField (FieldID)
function CalcAdultFee (EntryID)
{
var fee=0.00;
// Retrieve data values from the form.
var AdultRegType = GetField ("AdultRegType_" + EntryID);
var AdultTSCredit = GetField ("AdultTSCredit_" + EntryID);
var AdultPrayerRetreat = GetField ("AdultPrayerRetreat_" + EntryID);
var AdultFee = GetField ("AdultFee_" + EntryID);
// Check that the current date is before the early-bird cutoff.
if (new Date() < new Date(2012, 8, 29)) {
// Determine the fee based on the registration type selected. Add costs for Temple School
// Credit and Adult Prayer Retreat if selected. If the user is only going to the Friday
// Friday prayer retreat, do not add the additional option if selected.
switch (AdultRegType.value) {
case "Adult Registration":
fee = 85.00 + parseFloat((AdultTSCredit.checked) ? 10 : 0) + parseFloat((AdultPrayerRetreat.checked) ? 35: 0);
break;
case "College Student":
fee = 25.00 + parseFloat((AdultTSCredit.checked) ? 10 : 0) + parseFloat((AdultPrayerRetreat.checked) ? 35: 0);
break;
case "IHQ/Field Staff":
fee = 42.50 + parseFloat((AdultTSCredit.checked) ? 10 : 0) + parseFloat((AdultPrayerRetreat.checked) ? 35: 0);
break;
case "ONLY Friday Prayer Retreat":
fee = 35.00 + parseFloat((AdultTSCredit.checked) ? 10 : 0);
break;
default:
fee = 0.00;
} //endswitch (RegType)
// elseif (new Date() < new Date(2012, 8, 29))
}//endif (new Date() < new Date(2012, 8, 29))
AdultFee.value = fee;
CalcGrandTotal();
} //endfunction CalcAdultFee (RegType)
IE8中的问题是,在用户点击字段之前,新值不会出现在表单上。这似乎在IE9,FF12和Safari中运行良好。我肯定错过了什么。我该怎么办?