我想提交一个表单弹出窗口。
父.html
<form class="myform" name="forms" onsubmit="return submit_form()" >
</form>
<form class="myform" name="forms" >
</form>
<form class="myform" name="forms" >
</form>
Parent.html JAVASCRIPT
<script>
function submit_form()
{
console.log(0);
return false;
}
window.onload = function(){
//attach eventListner
document.getElementsByName("forms").addEventListner("submit",function(){
console.log(1);
return false;
},false);
//IN JQUERY
$(document).ready(function(){
$(".myform").live("submit",function(){
console.log(2);return false;
});
});
};
</script>
我正在使用window.open
方法打开一个新的弹出窗口,
我正在尝试从弹出窗口提交表单,如下所示...
var docs = window.opener.document ;
//first try to submit through jQuery
$(docs).find("form").eq(0).submit(); // it will work all browsers except IE8
or
docs.getElementsByTagName("form")[0].submit(); // it will work everywhere ,but on parent window the form will submitted by default (no attached events will work)
请帮忙 ..
谢谢。