关于写脚本的问题!

来源:百度知道 编辑:UC知道 时间:2024/05/27 06:30:09
<script language="Javascript">
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/translate_t?text='+t+'&hl=en&langpair=en|zh-CN&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+escape(location.href)+'&hl=en&langpair=en|zh-CN&tbb=1&ie='+e;};
</script>

这是一个IE的插键!
我想让{location.href='http://translate.google.com/translate_t?text=&

{window.open('http://translate.google.com/translate_t?text='+t+'&hl=en&langpair=en|zh-CN&tbb=1&ie='+e;},'_blank')}

可不可以用 location.target="_blank"

在新页加上<script...>location.href='http://translate.google.com/translate_t?text='+t+'&hl=en&langpair=en|zh-CN&tbb=1&ie='+e;</script>直接window.open(新页)新页会自动执行这段脚本