asp.net 后台 修改 javascript 变量

时间:2022-05-07 19:28:49
        Util.JSSetChange(Page, GetType());

        public static void JSSetChange(Page page, Type cstype)
{
// Define the name of the client scripts on the page.
String csname1 = "ClickScript"; // Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = page.ClientScript; // Check to see if the startup script is already registered.
if (!cs.IsStartupScriptRegistered(cstype, csname1))
{
String cstext1 = "hasChanged = true;"; //前台界面有个页面级别的变量叫hasChanged
cs.RegisterStartupScript(cstype, csname1, cstext1, true);
}
}