protected void Button1_Click(object sender, EventArgs e)
{
ClientScriptManager cs = this.ClientScript;
cs.RegisterArrayDeclaration("Hello", "1, 2, 3");
cs.RegisterClientScriptBlock(this.GetType(), "HelloWorld", "function helloWorld(){alert(1);}", true);
cs.RegisterClientScriptInclude("HelloWorld", "HelloWorld.js");
// cs.RegisterClientScriptResource(
cs.RegisterExpandoAttribute(this.Button1.ClientID, "Hello", "World");
cs.RegisterHiddenField("hello", "world");
cs.RegisterOnSubmitStatement(this.GetType(), "HelloWorld", "return window.confirm('Do you really want to submit the form?')");
cs.RegisterStartupScript(this.GetType(), "HelloWorld", "<script>alert('The page has loaded!')</script>");
}
{
ClientScriptManager cs = this.ClientScript;
cs.RegisterArrayDeclaration("Hello", "1, 2, 3");
cs.RegisterClientScriptBlock(this.GetType(), "HelloWorld", "function helloWorld(){alert(1);}", true);
cs.RegisterClientScriptInclude("HelloWorld", "HelloWorld.js");
// cs.RegisterClientScriptResource(
cs.RegisterExpandoAttribute(this.Button1.ClientID, "Hello", "World");
cs.RegisterHiddenField("hello", "world");
cs.RegisterOnSubmitStatement(this.GetType(), "HelloWorld", "return window.confirm('Do you really want to submit the form?')");
cs.RegisterStartupScript(this.GetType(), "HelloWorld", "<script>alert('The page has loaded!')</script>");
}
浙公网安备 33010602011771号