方案一:
使用
body
标签的
on<wbr style="line-height:28px">load</wbr>
方法提交
form
表单即可。
具体如下例:
<body οnlοad="form.submit();">
<form name="form" action="url" method="post">
<input type="text" id="name" value="zhang"/>
</form>
</body>
方案二:
通过Javascript起到主动提交表单的作用
代码A部分:
<body>
<form id="form1" method="post" action="../weblogin/SSO.aspx" runat="server">
<div>
<form name="form" action="url" method="post">
<input type="text" id="name" value="zhang"/ style="display:none" runat="server">
</form>
</div>
</form>
</body>
代码B部分:
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function sub() {
form1.submit();
}
</script>
</head>
A与B均为前台aspx页面的代码,该
Javascript代码的运行需要在后台,调用,后台调用代码如下:
ClientScript.RegisterStartupScript(this.GetType(), "message", "<script language='javascript' >sub();</script>");