父页面需要和iframe的页面同域,如果是跨域自己搜索跨域。
要监听iframe的页面是不是全部加载了,至少要监听到你要模拟点击的按钮是不是加载出来了.
allinput[i].click()才会执行,需要括号。
1、使用js模拟,其实就是给按钮添加onclick命令,然后表单action写好跳转后台处理方法,数据发送方式,默认的发送命令是form.submit()。直接发送出去。<form action="/fmpost" method="post" name="fm">
<button name="btn" onclick="fm.submit()"></button>
</form>
2、或者表单action不写跳转方法,直接在button的onclick上写好发送链接。
<form action="" method="post" name="fm" id="fm">
<button name="btn" onclick="document.getElementById('fm').action='/fmpost'document.getElementById('fm').submit()"></button></form>
可以根据通过标签名的方式进行获取元素
document.getElementsByTagName("span")
js获取dom元素的方式有8种
通过ID获取(getElementById)
通过name属性(getElementsByName)
通过标签名(getElementsByTagName)
通过类名(getElementsByClassName)
获取html的方法(document.documentElement)
获取body的方法(document.body)
通过选择器获取一个元素(querySelector)
通过选择器获取一组元素(querySelectorAll)