你會如此善待啓發我;我有以下問題Bootbox:如何添加'提示'
在jcertify.html有:
<!-- Bootbox utilities
================================================== -->
<script src"../static/assets/js/email_sign_up.js"></script>
</body>
在email_sign_up.js有:
function emailSignUp()
{
bootbox.prompt("<strong>Email address</strong>Enter email address where the report should be send to : ", function(result) {
if (result) {
// Example.show("email: <b>"+result+"</b>");
console.log("NikoS");
}
});
}
在jcertify.html它像:
<p><a href="javascript:console.log('hi there');emailSignUp();" class="bb-trigger btn btn-primary btn-lg btn-block">Sign up</a></p>
在瀏覽器的調試器,當我點擊「註冊」按鈕,我看到的是:
[登錄]您好(jcertify,1號線) [錯誤]的ReferenceError:找不到變量:emailSignUp global code(jcertify,line 1)
你知道我在做什麼錯嗎?
你能檢查email_sign_up.js成功被加載到瀏覽器? – Shriike 2014-11-06 15:44:36
未加載?爲什麼如此,因爲它被引用? – iamsterdam 2014-11-06 15:47:23
那麼有很多原因。也許你的道路實際上是不正確的。也許在函數聲明前的文件開始處有一個javascript錯誤。確實很難調試。在瀏覽器的控制檯中,您可以嘗試輸入emailSignUp()並查看是否有效。 – Shriike 2014-11-06 16:26:18