【发布时间】:2013-06-04 13:13:05
【问题描述】:
我已经多次使用这个插件,方式与这里看到的非常相似,但我的最新实现无法正常工作。
这里是 JavaScript:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/jquery.blockUI.js" type="text/javascript"></script>
<script type="text/javascript">
function disableButtons(){
alert('TEST'); //this is here just to see if the function is called
$('div.blockbutton').block({
message: '<h4>Saving...</h4>',
css: { border: '2px solid orange' }
});
}
</script>
还有 HTML:
<div align="center" class="blockbutton">
<input name="save" type="button" class="btn6022" value="Save"
onClick=disableButtons();
<c:if test='${(sessionScope.package != "NWR")}'>
saveConfirm1(onset_date,report_date,lost_consciousness_date,fatal_death_date);">
</c:if>
<c:if test='${(sessionScope.package == "NWR")}'>
"saveConfirm2(onset_date,report_date,fatal_death_date);">
</c:if>
</div>
这是我的 Firebug 控制台在触发该功能时给我的信息: TypeError: $(...).block 不是函数 [打破这个错误]
css: { 边框:'2px 纯橙色' }
我很困惑,因为这段代码与我在其他页面上所做的相同,没有失败。有人可以在这里发现我遗漏的问题吗?
【问题讨论】:
-
发布我的答案后,我意识到您可能正在尝试做什么。您是否尝试同时调用 disableButtons() 和 saveConfirm1/2 onClick?
-
没错,我同时称呼他们。 disableButtons() 被调用,因为弹出了我作为测试输入的警报,但该函数的其余部分失败,因此也无法调用 saveConfirm1/2 函数。
标签: javascript jquery blockui jquery-blockui