문제

onblur를 사용하여 type= text 또는 textArea 입력을 유효성을 검사 할 수 있지만 type= 파일에 대해 작동하도록 동일하게 사용할 수 없었습니다.

이 작품 :

<input type='text' name='sometextfield' size=30 class='input' onBlur="alert('Frell me dead, it works!');"
.

이것은 (오류 없음)

  <input type='file' name='file_upload' size=30 class='input' onBlur="alert('Frell me dead, it works!');"> 
.

Type= 파일 입력 상자가 비행기에있는 트릭은 무엇입니까?바닐라 자바 스크립트 에서이 작업을하고 싶습니다.나는 우분투 하에서 크롬 17.0.963.56 및 Firefox 10.0.2로 테스트하고 있습니다.

팁 / 포인터에 감사드립니다.

도움이 되었습니까?

해결책

onchange-event를 사용해보십시오 :

<input type="file" name="file_upload" size="30" class="input" onchange="alert('Frell me dead, it works!');">
.

demo : http://jsfiddle.net/timwolla/azvgp/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top