이 빠른 스크립트를 StackOverflow의 다른 게시물에서 가져 왔지만 양식에서 작동하지 않는 것 같습니다. 그냥 'object expected'라는 오류를 던집니다. 아무도 내가 그것을 고칠 수 있습니다.자바 스크립트 자동 양식 제출
는<html>
<head></head>
<body onLoad="document.forms[0].submit()">
<form name="EPDQForm" method="post" action="mypage.aspx" >
<input name="item" type="hidden" value="data">
</form>
</body>
</html>
편집 :
이 정확한 페이지 코드 (여기에 표시 그것의 대부분을 제거) :
<html><head></head>
<body onLoad="document.forms[0].submit()">
<form id="myform" name="myform" method="post" action="https://secure2.mde.epdq.co.uk/cgi-bin/CcxBarclaysEpdq.e" >
<input name="epdqdata" type="hidden" value="972">
<input name="returnurl" type="hidden" value="http://www.xxxx.co.uk/Secure/EPDQReturn.aspx">
<input name="merchantdisplayname" type="hidden" value="xxxxxx">
<input name="submit" type="hidden" value="purchase">
<input name="shipping" type="hidden" value="0.00">
<input name="baddr1" type="hidden" value="152 Smith St">
<input name="baddr2" type="hidden" value="">
<input name="bcity" type="hidden" value="Manchester">
<input name="bcountry" type="hidden" value="UK">
<input name="bpostalcode" type="hidden" value="M4 6DH">
<input name="email" type="hidden" value="[email protected]">
<input name="saddr1" type="hidden" value="152 Smith St">
<input name="scity" type="hidden" value="Manchester">
<input name="scountyprovince" type="hidden" value="Alderney">
<input name="scountry" type="hidden" value="UK">
<input name="spostalcode" type="hidden" value="M4 5GG">
</form></body></html>
이 코드는 오류를 보여줍니다. 나는 왜 그런지 보지 못한다. 파이어 폭스에서는 말한다 :
document.forms[0].submit is not a function
실제 전체 코드가 표시되도록 질문을 업데이트했습니다. 이 코드는 오류를 재생산합니다. –
문제는이 부분에 있습니다 : . 제출 입력은 양식 기능과 동일한 이름을가집니다. 이름을 다른 이름 (예 : submit1)으로 대체하면 매력으로 작동해야합니다. – KShadows