有这样一个页面test.aspx,点击里面的submit按钮后会登录并跳到http://www.xxx.cn/页面
<form action="http://www.xxx.cn/login.aspx" method="post"
name="form1" id="form1">
<input type="hidden" name="username" id="username" />
<input type="hidden" name="password" id="password" />
<input type="submit" name="submit" id="submit" value="Submit" />
</form>
我想实现test.aspx加载后不用点击submit按钮也实现相同的功能,即模拟自动点击submit的功能,可以实现吗?谢谢。
<form action="http://www.xxx.cn/login.aspx" method="post"
name="form1" id="form1">
<input type="hidden" name="username" id="username" />
<input type="hidden" name="password" id="password" />
<input type="submit" name="submit" id="submit" value="Submit" />
</form>
我想实现test.aspx加载后不用点击submit按钮也实现相同的功能,即模拟自动点击submit的功能,可以实现吗?谢谢。
<form action="http://www.xxx.cn/login.aspx" method="post"
name="form1" id="form1">
<input type="hidden" name="username" id="username" />
<input type="hidden" name="password" id="password" />
<input type="submit" name="submit" id="submit" value="Submit" />
</form>js:
<script type="text/javascript">
function test() {
document.getElementById("username").value = "aaa";
document.getElementById("password").value = "bbb"; alert(document.getElementById("username").value);
alert(document.getElementById("password").value);
document.getElementById("submit").click(); }
</script>
$("#frmMain").action="dosubmit.aspx";$("#frmMain").submit();