1

在我的 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 中运行良好。我肯定错过了什么。我该怎么办?

4

0 回答 0