stack overflow at line 错误原因及解决
发布时间:2025-12-09 13:40:18
浏览次数:3
错误表现: 按关闭窗口按钮时,弹出对话框:stack overflow at line 87. 那个按键的onclick = “window.close()”
很简单的代码,不知道为什么总是出错,后来找了一下,发现原因是:
我的代码为:
- <scriptlanguage=“JavaScript”>
- functionclose()
- {
- window.opener.document.all.create911.PSAPName.disabled=true;
- window.opener.document.all.create911.district.disabled=true;
- window.opener.document.all.create911.serviceMunicipality.disabled=true;
- window.opener.document.all.create911.emergencyServiceZone.disabled=true;
- window.close();
- }
-
- </script>
- 。。。。。。
- <INPUT type=”button” value=”Close Window” onClick=”window.close()”>
看上去程序没有问题,但是注意看JS里面有个函数也取名为close(),正好与window.close()重名了,为此就出现了那个问题。