我已经继承了一些Javascript,这个JS曾经工作过,但由于某种原因它不再有效。类型错误,而不是函数
我有以下脚本,请记住我斩下来,只列出违规的部分:
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>
我调用的函数bottom_frame()
,show_start()
和top_frame()
页面底部的HTML。但是,我在错误标签中看到以下消息:
TypeError: top.bottom_frame is not a function
我在每个函数调用中都看到了这一点。任何人都可以提出什么问题在这里?
这里'函数bottom_frame(){ bottom_frame =顶部。 frames [2] .document;'你重新定义了从函数到文档的'bottom_frame'。所以,这段代码第一次工作,然后失败 – Grundy