Skip to content

Instantly share code, notes, and snippets.

@bestpika
Created November 5, 2015 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bestpika/fe6dbe65dba600a29284 to your computer and use it in GitHub Desktop.
Save bestpika/fe6dbe65dba600a29284 to your computer and use it in GitHub Desktop.
執行網頁內 js 的方法
public static void js(string func)
{
var page = HttpContext.Current.Handler as Page;
page.ClientScript.RegisterClientScriptBlock(page.GetType(), "js", func, true);
// var script = new LiteralControl(string.Format("<script>{0}</script>", func));
// page.Controls.Add(script);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment