从服务器端调用Javascript函数

在按钮上单击我调用服务器端function,我在其中调用Javascript函数

Page.ClientScript.RegisterStartupScript( this.GetType(), "scriptsKey", "test();"); 

但是Javascript函数没有调用。

您可以从后面的代码调用该函数,如下所示:

MyForm.aspx.cs

 protected void MyButton_Click(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "AnotherFunction();", true); } 

MyForm.aspx

   My Page     
Merchant Store Terminal

 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "scr", "javascript:test();", true); 

这对我有用。 希望它也适合你。

 ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Test();", true); 

我已经编辑了你提供的html页面。 更新的页面如下

    My Page     
Merchant Store Terminal