2013-01-18 109 views
0

所以我在表單中有這個單選按鈕和文本字段。當頁面加載時,禁用字段方法被調用並禁用文本字段。接下來我要做的是通過激活單選按鈕重新啓用文本字段。因此,我在調用enablefield方法的單選按鈕上有一個onclick事件。但它拒絕重新激活文本框。它是你認爲的語法嗎?Onclick On Radio Button Not Working

<form> 
<input type="radio" name="asiinternship" value="Tadween Publishing" onclick="enableField(applyingforother)" />Other <input type="text" name="applyingforother" maxlength="56" style="width:143px;margin-bottom:20px;" /> 
</form> 

<script> 
     function enableField(myField) 
      { 
      myField.disabled = false 
      return true 
      } 

     function disableField(myField) 
      { 
      myField.disabled = true 
      return true 
      }  

     disableField(document.forms["contact_form"].applyingforother) 

</script> 

回答

1

你缺少報價:

onclick="enableField(applyingforother) 

應該是:

onclick="enableField('applyingforother') 
+0

Accordingo到ECMA腳本5.x的,你還需要;最後。 –

+0

試過了,似乎沒有辦法:/ 克勞迪奧一個分號在哪裏? '申請其他'結束? – Frisbetarian