通过javascript(书签):我需要创建一个iframe,然后向它添加一个表单,然后提交表单的脚本。AppendChild在IE中的iframe
在Chrome下工作,但不是在IE:
var i = document.createElement('iframe'); // also give it id = iframe_id
var frm = document.createElement('form'); // also add inputs and values
var s = document.createElement('script'); // also add innerHTML that submits form
document.body.appendChild(i);
window.frames['iframe_id'].document.getElementsByTagName('body')[0].appendChild(frm);
window.frames['iframe_id'].document.getElementsByTagName('body')[0].appendChild(s);
在IE中我得到一个错误:未定义或空引用无法获取财产“的appendChild”
我试图追加表单和脚本添加到iframe中,然后将iframe添加到文档中:
i.appendChild(frm);
i.appendChild(s);
document.body.appendChild(i);
我在Chrome中出现了一个奇怪的响应。表单提交的响应出现在阻止的弹出窗口中(而不是我所期望的)。在IE中似乎没有什么发生。
您打算支持哪些版本的IE? – acdcjunior