window.open 不是函数错误,请帮助。到处都看了,看不懂
window.open is not a function error, Please help. I have looked everywhere, cant understand
link 到视频:https://www.youtube.com/watch?v=MY1JKlJj7aY
<a href="javascript://" onclick="window.open('/index/11','upp','scrollbars=1,top=0,left=0,resizable=1,width=680,height=350');return false;" rel="nofollow" class="profile-settings" title="Hастройки"></a>
网站:http://tmptstdays4god.ucoz.com/load/test_1/zavet_music/2-1-0-11
如果你覆盖了 window
属性 你可以自己调用 open
或使用以下技巧获取全局上下文(不适用于严格模式) :
new Function('return this;')().open('/index/11','upp','scrollbars=1,top=0,left=0,resizable=1,width=680,height=350');
您也可以将 window 称为 self
或(parent
和 top
如果您不在一个框架中):
console.log(window === self); // true
console.log(window === parent); // true if no frames
console.log(window === top); // true if no frames
您似乎已经为脚本中的 window.open 某处分配了一些值。查找可能无意中执行此操作的上游代码。
这重现了您的问题:
window.open = "no such function";
window.open('/index/11','upp','scrollbars=1,top=0,left=0,resizable=1,width=680,height=350');
link 到视频:https://www.youtube.com/watch?v=MY1JKlJj7aY
<a href="javascript://" onclick="window.open('/index/11','upp','scrollbars=1,top=0,left=0,resizable=1,width=680,height=350');return false;" rel="nofollow" class="profile-settings" title="Hастройки"></a>
网站:http://tmptstdays4god.ucoz.com/load/test_1/zavet_music/2-1-0-11
如果你覆盖了 window
属性 你可以自己调用 open
或使用以下技巧获取全局上下文(不适用于严格模式) :
new Function('return this;')().open('/index/11','upp','scrollbars=1,top=0,left=0,resizable=1,width=680,height=350');
您也可以将 window 称为 self
或(parent
和 top
如果您不在一个框架中):
console.log(window === self); // true
console.log(window === parent); // true if no frames
console.log(window === top); // true if no frames
您似乎已经为脚本中的 window.open 某处分配了一些值。查找可能无意中执行此操作的上游代码。
这重现了您的问题:
window.open = "no such function";
window.open('/index/11','upp','scrollbars=1,top=0,left=0,resizable=1,width=680,height=350');