日期:2014-05-17  浏览次数:20891 次

[ASP.net]用js脚本实现客户端点击按钮递交表单动作

其实,很简单,不要想复杂了


<html>
<head>
<script language="javascript">
		window.onload=function() 
			 {
				//自动点击登陆按钮,用checked来验证
				if (document.all.item("click_yanzheng").checked)
				{
				document.all.item("click_yanzheng").checked=false;				
				document.getElementById("im_but").click();//在pageload的时候自动click,这句是重点!			
				}
			}
</script>
</head>
<body>
<form>
	...
	<asp:imagebutton id="im_but" runat="server" ImageUrl="04.gif" ImageAlign="Middle"></asp:imagebutton>
	<asp:checkbox id="click_yanzheng" runat="server" Visible="true" checked="true"></asp:checkbox>
</form>
</body></html>