0

使用此示例代码,我正在尝试启用/禁用“arrdatfrom”字段。但是,一旦禁用此文本字段,我就无法重新启用它。当用户单击“刷新”按钮时,将执行以下功能。我建立了这个小演示只是为了证明我已经尝试了很多方法来做到这一点。有任何想法吗?

function showBooking() {
    var d = new Date()
    formvals.arrdatefrom    = document.getElementById("arrdatfrom").value
    formvals.arrdatethru    = document.getElementById("arrdatthru").value
    formvals.depdatefrom    = document.getElementById("depdatfrom").value
    formvals.depdatethru    = document.getElementById("depdatthru").value
    formvals.bookname       = document.getElementById("bookname").value
    formvals.peakroomfrom   = document.getElementById("peakroomfrom").value
    formvals.peakroomthru   = document.getElementById("peakroomthru").value
    formvals.peakattendfrom = document.getElementById("peakattendfrom").value
    formvals.peakattendthru = document.getElementById("peakattendthru").value

    alert (' ngs.hta  ready to enable')
    document.getElementById("arrdatfrom").enabled = 'true'

    alert ('ngs.hta in showBooking!!  disable.  ')
    document.getElementById("arrdatfrom").disabled = 'true'
    ...
4

1 回答 1

0

没有财产.enabled。要重新启用禁用的元素,请设置.disabled = false.

于 2013-04-16T18:08:08.420 回答