“需要对象”在 IE7 中从 jsp 调用 javascript 时出错
我收到一个非常奇怪的错误,我似乎无法在代码中摆脱它。在我的 jsp 底部,我有以下代码片段:
<jsp:include page="YuiCalendar.jsp" />
<script>
YAHOO.vgi.popcal.calendar.init();
alert(YAHOO.vgi.popcal.calendar.init);
</script>
第一次调用 init 抛出“Object required”错误,起初我以为我可能错误地调用了它,但警报语句正确返回并显示 YuiCalendar 中的方法,但是添加'()'会导致抛出错误,init方法没有输入参数。使这个问题变得更奇怪的是我在另一个 .jsp 中有完全相同的几行代码,并且工作正常。所有 .jsp 文件也位于同一文件夹中。
I am getting a very odd error that I can't seem to get rid of in my code. At the bottom of my jsp I have the following code snippit:
<jsp:include page="YuiCalendar.jsp" />
<script>
YAHOO.vgi.popcal.calendar.init();
alert(YAHOO.vgi.popcal.calendar.init);
</script>
The first call to init is throwing the "Object Required" error, at first I thought I may be calling it incorrectly, but the alert statement correctly returns and shows the method from YuiCalendar, but adding the '()' causes the error to be thrown, the init method has no input paramenters. What makes this problem even odder is I have the exact same few lines of code in another .jsp, and that works fine. All the .jsp files are in the same folder as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
谢谢 Pointy,你是对的,函数中出现错误是由于 .jsp 本身缺少标签引起的。
Thank you Pointy, you were correct, there was an error in the function that was being caused by a missing tag in the .jsp itself.