좋은 하루, 나는 찾아보기 파일 요소에 클릭을 시뮬레이션하기 위해 노력하고있어하지만 난 그것이 작동하지 수자바 스크립트 : <입력 유형 = "파일">
에서 클릭을 시뮬레이션합니다.
내가이 발견 http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/을하고 시도하고는 '버튼'에서 작동하고 '제출'유형 :
<input type="checkbox" onClick="document.getElementById('theSubmitButton').click();">Check the box to simulate a button click
<input type="submit" name="theSubmitButton" id="theSubmitButton" value="Button" onClick="alert('The button was clicked.');">
을하지만 난 '파일'형태로 변경하려고 할 때 :
<input type="checkbox" onClick="document.getElementById('theSubmitButton').click();">Check the box to simulate a button click
<input type="file" name="theSubmitButton" id="theSubmitButton" value="Button" onClick="alert('The button was clicked.');">
Firefox와 IE8에서는 작동하지 않습니다. 하지만 파일 브라우저 창이 Google 크롬에 나타납니다.
이 방법에 문제가 있습니까? FF 및 IE8에서 어떻게 작동합니까?
대단히 감사합니다!
이 답변에 그냥 추가 :이 테스트의 목적을위한 경우에 당신은 FuncUnit처럼, 어떤 기존의 프레임 워크를 사용할 수 있습니다. – bezmax
제 질문에 답해 주셔서 대단히 감사합니다. :) – srcastro
"보안", "기능" – user445786