【发布时间】:2016-05-16 11:20:56
【问题描述】:
我现在有一个显示 JS 警报的单行代码。我正在尝试用 jQuery 警报替换它,以便我可以为它设置主题。下面是我为 jQuery alert 写的代码:
ScriptManager.RegisterStartupScript(this, GetType(), "onload",
"window.onload = function () {jAlert('This is a custom alert box', 'Alert Dialog');}", true);
这段代码以前是这样的:
ScriptManager.RegisterStartupScript(this, GetType(), "showalert",
"alert('This is a custom alert box');", true);
现有代码运行良好。但是我的代码给了我一个错误提示,
value of property jalert is null
我不确定,我在这里缺少什么。
【问题讨论】:
-
在 onload 函数触发时是否将 jquery.js 加载到浏览器?
-
我想是的。不知道如何检查它是否是。我应该将 onload 更改为其他内容吗?
标签: javascript jquery asp.net