我接手了一些JavaScript代码,这段代码曾经有效,但出于某种原因,它现在不再起作用。
我有以下脚本,请注意,我已经删除了部分内容并仅列出了有问题的部分:
我正在页面底部的HTML中调用
我有以下脚本,请注意,我已经删除了部分内容并仅列出了有问题的部分:
function top_frame() {
top_frame = top.frames[0].document;
top_frame.write('<HTML><BODY topmargin=0 leftmargin=0 marginheight=0 marginwidth=0><IMG SRC="'+image_url+'/options_top.gif" HEIGHT=25 WIDTH=300></BODY></HTML>')
// top_frame.write('<HTML><BODY BGCOLOR="#339999"><IMG SRC="images/global/options_top.gif" WIDTH=300 HEIGHT=25 ALT="Product options editor" BORDER="0"></BODY></HTML>')
top_frame.close();
}
function bottom_frame() {
bottom_frame = top.frames[2].document;
bottom_frame.write('<HTML><BODY topmargin=0 leftmargin=0 marginheight=0 marginwidth=0><A HREF="javascript:top.update_options()"><IMG SRC="'+image_url+'/options_end.gif" WIDTH=300 HEIGHT=30 ALT="Update and close" BORDER="0"></A></BODY></HTML>')
bottom_frame.close();
}
</SCRIPT>
<frameset rows="26,*,31" frameborder="NO" border="0" framespacing="0">
<frame src="javascript:top.top_frame()"
scrolling="NO" marginwidth="0" marginheight="0" frameborder="NO"
NAME="options_top">
<frame src="javascript:top.show_start()"
marginwidth="0" marginheight="0" frameborder="NO" scrolling="auto"
NAME="options_main">
<frame src="javascript:top.bottom_frame()"
scrolling="NO" marginwidth="0" marginheight="0" frameborder="NO"
NAME="options_bottom">
</frameset>
</HTML>
我正在页面底部的HTML中调用
bottom_frame()
、show_start()
和top_frame()
函数。然而,在错误选项卡中,我看到以下信息:TypeError: top.bottom_frame is not a function
我在每个函数调用中都看到这个。有人能建议一下这里的问题是什么吗?
function bottom_frame() { bottom_frame = top.frames[2].document;
你将bottom_frame
从函数重新定义为文档。所以,这段代码第一次可以工作,但之后会失败。 - Grundy