Javascript 什么是[对象窗口]?

Javascript 什么是[对象窗口]?,javascript,Javascript,Google Translate有一些书签,只需点击一次即可进行翻译,例如: javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.sel

Google Translate有一些书签,只需点击一次即可进行翻译,例如:

javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com/?text='+t+'&hl=en&langpair=auto|en&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&hl=en&langpair=auto|en&tbb=1&ie='+e;};
这段javascript代码打开了当前页面中的translator页面(target=\u self),但我希望它打开一个新的Translation窗口(选项卡)。因此改为:

javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){window.open('http://translate.google.com/?text='+t+'&hl=en&langpair=auto|en&tbb=1&ie='+e);}else{window.open('http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&hl=en&langpair=auto|en&tbb=1&ie='+e);};
我的问题是:当我运行代码时,它会打开一个新的翻译窗口,并执行它;但是非英语页面内容替换为
[对象窗口]
,但我不想更改原始页面内容

我能做什么

谢谢。

在末尾添加
void(0)
,这样就没有价值了。如果最后一个表达式有一个值(在本例中是一个窗口),则页面将替换为该值。