.net 后台调用前台js方法
aspx:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function a() {
alert("ceshi");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>
aspx.cs:
protected void Button1_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(ClientScript.GetType(), "a", "<script>a();</script>");
}

浙公网安备 33010602011771号