【搞定】懂script脚本的来帮忙看看
saya大哥的 google翻译插件我修改了那个googletranslate.htm 文件
在里面去掉了一些不想要的翻译(韩,日,意大利等等) ,弄成了简体,然后修改了弹出窗口的大小
看界面:
[img]http://bbs.ioage.com/cn/attachment.php?aid=31040&noupdate=yes[/img][img]http://bbs.ioage.com/cn/images/default/attachimg.gif[/img]
[size=4][color=red]请问1, 怎么修改弹出窗口的显示位置[/color][/size]
[size=4][color=red] 2,窗口里面还有1个框 那个框下面没了,怎么弄[/color][/size]
这是我修改的:
<script language="Javascript">
function goGoogle(toLang)
{
if (objPopup) objPopup.hide();
var newwin = top.window.open();
if (newwin)
newwin.location = "[url=http://www.google.com.cn/translate?u=]http://www.google.com.cn/translate?u="+top.document.location+"&langpair="+toLang+"&hl=zh-CN&ie=UTF8[/url]";
else
alert("弹出窗口被拦截。");
}
var objPopup = window.createPopup();
var objBody = objPopup.document.body;
objBody.style.border = "1 black solid";
objBody.style.margin = 10;
var strInner = "<center><select id=toLang size=19 onclick=parent.goGoogle(this.value)>";
strInner += "<option value=en|zh-CN>英文至中文(简体)</option>";
strInner += "<option value=zh|en>中文至英文</option>";
strInner += "<option value=zh-CN|zh-TW>中文(简体至繁体)</option>";
strInner += "<option value=zh-TW|zh-CN>中文(繁体至简体)</option>";
strInner += "</select></center>";
objBody.innerHTML = strInner;
objPopup.show(screen.width/2 - 75, screen.height/2 - 80, 160, 80);
</script>
[[i] 本帖最后由 擱淺Δē√瑷 于 2007-8-27 18:49 编辑 [/i]]
回复 #1 擱淺Δē√瑷 的帖子
問題一:objPopup.show(screen.width/2 - 75, screen.height/2 - 80, 160, 80);
screen.width/2-75
選框離左邊距離為(螢幕寬度/2 - 75)px位置
screen.height/2 - 80
選框離上方距離為(螢幕高度/2 - 80)px位置
160
選框寬度
80
選框高度
問題二
objBody.style.margin = 10;
選寬離上下左右距離10px, (因為置中, 所以左右方會參考問題一寬度)
var strInner = "<center><select id=toLang size=19 onclick=parent.goGoogle(this.value)>";
size為選框內選項數目19個
因你只有4個, 所以若要完整顯示, 源碼要改為下面就沒問題了。
<script language="Javascript">
function goGoogle(toLang)
{
if (objPopup) objPopup.hide();
var newwin = top.window.open();
if (newwin)
newwin.location = "http://www.google.com.cn/translate?u="+top.document.location+"&langpair="+toLang+"&hl=zh-CN&ie=UTF8";
else
alert("弹出窗口被拦截。");
}
var objPopup = window.createPopup();
var objBody = objPopup.document.body;
objBody.style.border = "1 black solid";
objBody.style.margin = 10;
var strInner = "<center><select id=toLang size=4 onclick=parent.goGoogle(this.value)>";
strInner += "<option value=en|zh-CN>英文至中文(简体)</option>";
strInner += "<option value=zh|en>中文至英文</option>";
strInner += "<option value=zh-CN|zh-TW>中文(简体至繁体)</option>";
strInner += "<option value=zh-TW|zh-CN>中文(繁体至简体)</option>";
strInner += "</select></center>";
objBody.innerHTML = strInner;
objPopup.show(screen.width/2 - 75, screen.height/2 - 80, 150, 95);
</script> [color=red]上面的代码最下面2行改成这样:[/color]
[color=blue]objPopup.show(screen.width/2 + 190, screen.height/2 + 220, 150, 95);[/color]
[color=blue]</script>[/color]
[size=4][color=red]看效果:[/color][/size]
[img]http://bbs.ioage.com/cn/attachment.php?aid=31066&noupdate=yes[/img]
[size=4][color=red]哈哈 点击方便了~!![/color][/size] 修改后的爽,发上来参考下!多多谢~ 好。
<script language="Javascript">
function goGoogle(toLang)
{
if (objPopup) objPopup.hide();
var newwin = top.window.open();
if (newwin)
newwin.location = "http://www.google.com.cn/translate?u="+top.document.location+"&langpair="+toLang+"&hl=zh-CN&ie=UTF8";
else
alert("弹出窗口被拦截。");
}
var objPopup = window.createPopup();
var objBody = objPopup.document.body;
objBody.style.border = "1 black solid";
objBody.style.margin = 10;
var strInner = "<center><select id=toLang size=4 onclick=parent.goGoogle(this.value)>";
strInner += "<option value=en|zh-CN>英文至中文(简体)</option>";
strInner += "<option value=zh|en>中文至英文</option>";
strInner += "<option value=zh-CN|zh-TW>中文(简体至繁体)</option>";
strInner += "<option value=zh-TW|zh-CN>中文(繁体至简体)</option>";
strInner += "</select></center>";
objBody.innerHTML = strInner;
objPopup.show(screen.width/2 + 190, screen.height/2 + 220, 150, 95);
</script> 请楼上的大虾把这个goole翻译插件(修改后的)重新发一遍,我不会搞JAV啊,帮帮忙了,谢谢
页:
[1]