C# 使用scriptmanager时不加载jquery函数
我目前有以下代码,在页面加载时显示jquery咆哮C# 使用scriptmanager时不加载jquery函数,c#,jquery,asp.net,code-behind,jgrowl,C#,Jquery,Asp.net,Code Behind,Jgrowl,我目前有以下代码,在页面加载时显示jquery咆哮 <script> window.onload = function () { var msg = "My alert message"; jQuery.jGrowl(msg, { life: 5000, theme: 'redgrowl' }); } </script> 但这并没有显示出任何东西。我的当前代码加载在window.onload页面的底部,就在body的末尾,
<script>
window.onload = function () {
var msg = "My alert message";
jQuery.jGrowl(msg, { life: 5000, theme: 'redgrowl' });
}
</script>
但这并没有显示出任何东西。我的当前代码加载在window.onload页面的底部,就在body的末尾,jquery.growl.js在head标记中。有什么不对劲吗 同时在代码的开头和结尾添加。很抱歉,这没有帮助。请检查浏览器控制台是否存在可能的错误。我看不到任何与此相关的错误…确定将
RegisterStartupScript
更改为RegisterClientScriptBlock
var sb = new StringBuilder();
sb.Append(" window.onload = function () {");
sb.Append(" var msg = \"Hello world\";");
sb.Append(" jQuery.jGrowl(msg, { life: 5000, theme: 'redgrowl' });");
sb.Append(" }");
ScriptManager.RegisterStartupScript(this, GetType(), "jgrowlwarn", sb.ToString(), true);