获取IFrame表单提交之后的返回值

来源:互联网 发布:php wiki系统 编辑:程序博客网 时间:2024/04/30 22:51
var doc = document.getElementById('interface_data').contentWindow.document; //'interface_data'是iframe的id
                doc.getElementById('topicid').value = v;
                doc.getElementById('form_addTo').action = action; //'form_addTo'是iframe页面中的form 的id
                doc.getElementById('form_addTo').submit();
                 
                var oFrm = document.getElementById("interface_data");
                oFrm.onload = oFrm.onreadystatechange = function() {
                     if (this.readyState && this.readyState != 'complete'return;
                     else{
                         
                        if (document.all){//IE
                                var sub_con = document.frames["interface_data"].document;
                        }else{//Firefox
                                var sub_con = document.getElementById("interface_data").contentDocument;
                                 
                        }
                                                 
                        sub_con = sub_con.body.innerHTML;  //取得返回值
                        alert(sub_con);
                  }
原创粉丝点击