0
我正在嘗試實現SimpleModal(http://www.ericmmartin.com/projects/simplemodal/)。但是,我收到了一個奇怪的錯誤。我無法修復,但希望你們可以。如果你能解釋爲什麼,那很好。Uncaught TypeError:undefined不是函數(匿名函數)
我已經做了一些調試。並且https://example.com/scripts/sm.js正確並加載。 (完全一樣:https://simplemodal.googlecode.com/files/jquery.simplemodal-1.4.4.js)
$("body").append("<script type=\"text/javascript\" src=\"https://example.com/scripts/sm.js\"></script>");
$("body").append("<style>#basic-modal-content{display:none}#simplemodal-overlay{background-color:#000}#simplemodal-container{height:360px;width:600px;color:#bbb;background-color:#333;border:4px solid #444;padding:12px}#simplemodal-container .simplemodal-data{padding:8px}#simplemodal-container code{background:#141414;border-left:3px solid #65B43D;color:#bbb;display:block;font-size:12px;margin-bottom:12px;padding:4px 6px 6px}#simplemodal-container a{color:#ddd}#simplemodal-container a.modalCloseImg{background:url(../img/basic/x.png) no-repeat;width:25px;height:29px;display:inline;z-index:3200;position:absolute;top:-15px;right:-16px;cursor:pointer}#simplemodal-container h3{color:#84b8d9}</style>");
$("body").append("<div id=\"basic-modal-content\"><h3>Basic Modal Dialog</h3><p>For this demo, SimpleModal is using this \"hidden\" data for its content. You can also populate the modal dialog with an AJAX response, standard HTML or DOM element(s).</p><p>Examples:</p><p><code>$('#basicModalContent').modal();// jQuery object - this demo</code></p><p><code>$.modal(document.getElementById('basicModalContent'));// DOM</code></p><p><code>$.modal('<p><b>HTML</b>elements</p>');// HTML</code></p><p><code>$('<div></div>').load('page.html').modal();// AJAX</code></p><p></p></div>");
$('#basic-modal-content').modal();
我在做什麼錯?