以下是我的Javascript文档,运行于$(document).ready()
。 Javascript是从我的网站页脚加载的。为简化起见,我已将[...]
代替不相关的代码。“Uncaught ReferenceError:AutoResize is not defined”
// When the document is ready, run the display scripts
$(document).ready(function() {
// Define the frame height functions
function getDocHeight(doc) {
[...]
}
document.domain = 'mysite.com';
function resizeIframe() {setIframeHeight('date-price-book');}
function setIframeHeight(ifrm) {
[...]
}
function AutoResize() {
resizeIframe();
resizeIframe();
setTimeout("AutoResize()", 500);
}
AutoResize();
[... more Javascript code...]
当我运行该页面时,出现错误:Uncaught ReferenceError: AutoResize() is not defined
。
我可以通过注释行AutoResize();
(上面示例代码中的最后一行)来阻止发生此错误。但为什么这个错误被抛出? AutoResize()函数刚好在它上面的行中定义了吗?
感谢您的帮助!
'setTimeout(AutoResize,500)'更好,并且可能会解决您的问题以启动。 – 2012-08-02 19:07:17