2013-01-18 2 views
0

그래서이 라디오 버튼과 텍스트 필드가 폼에 있습니다. 페이지가로드되면 비활성화 필드 메서드가 호출되고 텍스트 필드가 비활성화됩니다. 다음에해야 할 일은 라디오 버튼을 활성화하여 텍스트 필드를 다시 활성화하는 것입니다. 그러므로 enablefield 메소드를 호출하는 라디오 버튼에 onclick 이벤트가 있습니다. 그러나 텍스트 필드를 재 활성화하지 않았다. 그것이 당신이 생각하는 문법입니까?Onclick On 라디오 버튼이 작동하지 않습니다.

<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

시도해 보니 트릭을하지 않은 것 같습니다 :/ 세미 콜론 어디에서? 'applyforother'의 끝에서? – Frisbetarian

관련 문제