以前有寫過教學,最近又有人問,所以再寫一次,並且將按鈕更新為Mojolingo提供的按鈕,它們做得比較漂亮,有興趣研究請看:http://www.winperturn.com.tw/page_free_01.htm說明,它有完整可下載的程式,這裡我已經將圖片等上傳到Blog中,語法也將圖片網址更正,可以使用的語法如下↓,請自行更改整體按鈕顯示的位置。
=============================================================
<div>
<script language="JavaScript">
var d2d_oldHost;
function d2d_11D1_Translate(ToInt) {
var oldurl = "";
var wptToChar = ToInt;
var wptFromChar = 0;
var gw_table = new Array();
var d2d_oldUrl = d2d_11D1_OldUrl();
gw_table[0] = "tc_tc.c2c.idc.hinet.net";
gw_table[1] = "sc2tc.mojolingo.xuite.net";
gw_table[2] = "en2tc.mojolingo.xuite.net";
gw_table[3] = "jp2tc.mojolingo.xuite.net";
gw_table[4] = "tc2sc.mojolingo.xuite.net";
gw_table[5] = "sc_sc.c2c.idc.hinet.net";
gw_table[6] = "en2sc.mojolingo.xuite.net";
gw_table[7] = "jp2sc.mojolingo.xuite.net";
gw_table[8] = "tc2en.mojolingo.xuite.net";
gw_table[9] = "sc2en.mojolingo.xuite.net";
gw_table[10] = "en_en.c2c.idc.hinet.net";
gw_table[11] = "jp_en.c2c.idc.hinet.net";
gw_table[12] = "tc2jp.mojolingo.xuite.net";
gw_table[13] = "sc2jp.mojolingo.xuite.net";
gw_table[14] = "en_jp.c2c.idc.hinet.net";
gw_table[15] = "jp_jp.c2c.idc.hinet.net";
if (wptToChar == -1)
oldurl = "http"+"://" + d2d_oldUrl;
else
oldurl = "http"+"://" + gw_table[(wptToChar*4) + (wptFromChar*1)] + "/m2m-0000/" + d2d_oldUrl;
if (d2d_oldHost == null)
window.open(oldurl);
else
window.oldopen(oldurl);
}
function d2d_11D1_OldUrl() {
var curURL = window.top.location.href;
var prefix1 = "/m2m-0000/";
var prefix2 = "/http://";
var idx = curURL.indexOf(prefix1);
if (idx < 0) {
idx = curURL.indexOf(prefix2);
if (idx < 0) {
return curURL.substring("http://".length, curURL.length);
}
else {
idx += prefix2.length;
return curURL.substring(idx, curURL.length);
}
}
else {
idx += prefix1.length;
return curURL.substring(idx, curURL.length);
}
return curURL.substring("http://".length, curURL.length);
}
</script>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR VALIGN=TOP ALIGN=LEFT>
<TD WIDTH=5 HEIGHT=5>
<IMG SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/0.gif" WIDTH=5 HEIGHT=1 BORDER=0></TD>
<TD></TD>
</TR>
<TR VALIGN=TOP ALIGN=LEFT>
<TD></TD>
<TD WIDTH=176>
<TABLE ID="Table3" BORDER=0 CELLSPACING=1 CELLPADDING=0 WIDTH=176>
<TR>
<TD COLSPAN=4 HEIGHT=18><P>
<TABLE WIDTH=171 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><A HREF="http://www.mojolingo.xuite.net" target=_blank>
<IMG ID="MojoLingo" HEIGHT=45 WIDTH=171 SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/1.gif"
BORDER=0></A></TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD WIDTH=42><P>
<TABLE WIDTH=42 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><IMG ID="TC" HEIGHT=17 WIDTH=42 SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/2.gif" BORDER=0 style="cursor:hand" onclick="d2d_11D1_Translate(-1);"></TD>
</TR>
</TABLE>
</TD>
<TD WIDTH=42><P>
<TABLE WIDTH=42 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><IMG ID="SC" HEIGHT=17 WIDTH=42 SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/3.gif" BORDER=0 style="cursor:hand" onclick="d2d_11D1_Translate(1);"></TD>
</TR>
</TABLE>
</TD>
<TD WIDTH=42><P>
<TABLE WIDTH=42 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><IMG ID="JP" HEIGHT=17 WIDTH=42 SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/4.gif" BORDER=0 style="cursor:hand" onclick="d2d_11D1_Translate(3);"></TD>
</TR>
</TABLE>
</TD>
<TD WIDTH=45><P>
<TABLE WIDTH=42 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><IMG ID="EN" HEIGHT=17 WIDTH=42 SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/5.gif" BORDER=0 style="cursor:hand" onclick="d2d_11D1_Translate(2);"></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</div>
===========================================================
上面這個語法是當你的網頁主要是繁體中文所使用的翻譯按鈕,將語法貼進自訂欄位(自由欄位)中使用(這部份就不再貼教學啦),最簡單的用法是這些按鈕會在自訂欄位中顯示↓
如果進階一點,想要變換一下按鈕,讓它不在自由欄位中,跑到上面Banner檔頭區域,那就改第一行紅色字↓
<div>
在第一段語法改成↓
<div style ='position:absolute;top: -188px;left: -713px;'>
這裡面的數值(藍色字部份)請自行調整看看,可能是正的值,可能是負的值。以我自己為例,我將這段語法放在右側的自由欄位中,於是需要垂直往上的部份調整為減188,水平位置需要往左調整713pixel。我用圖片說明如下↓

因為右側自由欄位的左上角為座標原點(0,0)[圖上的藍色圓點],透過(Top, Left)所定義的位置(X,Y)(X, Y都是正的時候)[圖上的紅色圓點],其點位會是在座標原點的右下側,也就是說該點位與TOP距離X pixels,與Left左側原點距離Y pixels。所以我要它顯示在目前Demo的位置,其實就是Top為-188,Left為-713。也就是圖面上的綠色圓點位置。這樣不知道有沒有清楚?!
所以如果你是將語法貼進左側欄位,你的top可能是負值,但是left就可能是正值喔!你自己試看看,因為不同的CSS版位可能造成你的座標原點不同!!
接著就是補充說明其他不同的語言網頁所需要改的地方,
A. 如果你是用簡體字體寫Blog,那麼請將語法中的↓
<TD><IMG ID="TC" HEIGHT=17 WIDTH=42 SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/2.gif" BORDER=0 style="cursor:hand" onclick="d2d_11D1_Translate(-1);"></TD>
</TR>
</TABLE>
</TD>
<TD WIDTH=42><P>
<TABLE WIDTH=42 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><IMG ID="SC" HEIGHT=17 WIDTH=42 SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/3.gif" BORDER=0 style="cursor:hand" onclick="d2d_11D1_Translate(1);"></TD>
</TR>
</TABLE>
</TD>
<TD WIDTH=42><P>
<TABLE WIDTH=42 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><IMG ID="JP" HEIGHT=17 WIDTH=42 SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/4.gif" BORDER=0 style="cursor:hand" onclick="d2d_11D1_Translate(3);"></TD>
</TR>
</TABLE>
</TD>
<TD WIDTH=45><P>
<TABLE WIDTH=42 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><IMG ID="EN" HEIGHT=17 WIDTH=42 SRC="http://c.blog.xuite.net/c/f/7/b/11732000/blog_698/txt/13351829/5.gif" BORDER=0 style="cursor:hand" onclick="d2d_11D1_Translate(2);"></TD>
請注意這一段裡面的紅色字的部份就好,這裡面的四次呼叫d2d_11D1_Translate()函數時,括號裡面的參數它的順序依序為: -1, 1, 3, 2
如果你是用簡體寫日誌,那麼請將它們依序改為 0, -1, 3







