asp.net中Page.ClientScript.RegisterStartupScript用法小结

ClientScript.RegisterStartupScript(Page.GetType(), "Show", "alert('" + l_strConferenceNo + "');",true);原型如下

ClientScript.RegisterStartupScript(Type type, string key, string script,bool addScriptTags);区别是bool addScriptTags为true 我们需要写JavaScript实现代码就可以了,不用加<script></script>。

ClientScript.RegisterStartupScript(Page.GetType(), "Show", "<script>alert('" + l_strConferenceNo + "');</script>");原型如下

ClientScript.RegisterStartupScript(Type type, string key, string script);必须要加<script></script>。

原文地址:https://www.cnblogs.com/WarBlog/p/4462414.html