Home > Web Front-end > JS Tutorial > Convert Simplified Chinese to Traditional Chinese (implementation code)_javascript skills

Convert Simplified Chinese to Traditional Chinese (implementation code)_javascript skills

WBOY
Release: 2016-05-16 17:07:19
Original
1912 people have browsed it
Copy code The code is as follows:

var Default_isFT = 0 //The default is Traditional Chinese, 0-Simplified Chinese, 1-Traditional Chinese
var StranIt_Delay = 50 //Translation delay milliseconds (the purpose of setting this is to allow the web page to be displayed smoothly first)

//-----Start the code, don't change the following----- {
if(txt==""||txt==null)return ""
toFT=toFT==null?BodyIsFt:toFT
if(chgTxt)txt=txt.replace((toFT? "Simplified":"Traditional"),(toFT?"Traditional":"Simplified"))
if(toFT){return Traditionalized(txt)}
else {return Simplized(txt)}
}
//Convert the object, use recursion, peel it off layer by layer
function StranBody(fobj)
{
if(typeof(fobj)=="object"){var obj=fobj.childNodes }
else >     BodyIsFt=1 
                                                                                                       🎜>                                                                                        🎜> gb2big5_Obj.innerHTML=StranText(tmptxt,1,1)
gb2big5.title=StranText(gb2big5.title,1,1)
}
setCookie (JF_cn,BodyIsFt,7)
var obj=document.body.childNodes
}
for(var i=0;i {
var OO=obj.item(i)
if( "||BR|HR|TEXTAREA|".indexOf("|" OO.tagName "|")>0||OO==gb2big5_Obj)continue;
If(OO.title!=""&&OO.title !=null)OO.title=StranText(OO.title);
if(OO.alt!=""&&OO.alt!=null)OO.alt=StranText(OO.alt);
if( OO.tagName=="INPUT"&&OO.value!=""&&OO.type!="text"&&OO.type!="hidden")OO.value=StranText(OO.value);
if(OO. nodeType==3){OO.data=StranText(OO.data)}
else StranBody(OO)
}
}
function JTPYStr()
{
return '爱琱籱墄AO dam狠狠狠狠做做tridder The edge is derogatory, the braid is braided, the turtle is deflated, the Bin is on the shore, the cake is turned into a bowl, the divination is patched, the ginseng is added, the silkworm is left, the cabin is in the cabin, the toilet is in the toilet, the side book is measured, mixed with cicadas, gluttonous and slandered, entangled with shovels, produced in the trembling field, tasted long intestines The factory is full of money, the money truck is dusty, the Chen lining is said to be punished, the idiot is late, the shame is blazing, the insect is petting, the silk is ugly, the kitchen is hoeing, the base is stored, the sores are spread, the bruises are broken, the hammer is pure rhetoric, the words are clever, the onion is from the bush. Make up the mistake to bring the loan list, Dan Shan Shan, be afraid of the bullet, block the party gang, smash the island, pray for theft, steal the lamp, Deng enemy, deliver the point pad, electrolyte, hook, double spy, stack nail top ingot, set the Dongdong building, freeze the bucket calf alone. Reading, gambling, plating, forging, breaking satin, team, tonton blunt, seizing the goose's forehead, corrupting the hungry children, baiting and punishing the valve, enamel, vanadium, Fanfanfan, visiting the spinning, flying waste, many graves, vigorously indignant, Fenfengfengfengfeng crazy, Fengzuo satirical. The phoenix-skinned radiant Fufu complex burden obituary woman tied the calcium cover dry drive Gan Gang Gang Gang Gao pickaxe put pigeon pavilion chromium one to Gong Gonggong Gong hook ditch purchase enough Gu Gu cut Guanguan Guanguan customary Guanggui The silicon returns to the turtle's boudoir, the treacherous cabinet, the executioner's roller, the rolling pot, the country is horrified, the Han and Han dynasties are congratulated, and the red kettle is protected. Bribery and dirty gatherings, taboos, pictures of dirty gangs, harvesting goods, attacking machines, starving, ridiculing chickens, collecting extremely high-level collections, squeezing a few thistles, economic plans, Jiji, Jiji, Jiajia, potassium price, driving, annihilating, prison, and hard copywriting. Check the alkali and alkali, pick up, simple and thrifty, reduce the recommended threshold, inspect the base, see the key, the sword, the pulp, the pulp, the oar, the sauce, the glue, the sauce, the jiao, the hinge, the fluke, the foot, the dumpling, the sedan chair, the stalk, the stem, the menstrual period, the neck static mirror. Jing Jing Jing Jing Jing stable old horse evidence saw fear drama cuckoo silk Jie Jie knot command tight brocade only Jin Jing Jing Jue Jue Jun Jun Kai Kai Ke Ke Ke Ke reclamation earnestly dig out the trousers exaggerate the filial piety The wide mine is open, the situation is poor, the feed is broken, the wax is lai, the blue fence is the basket, the orchid is the Lan Lan, the lazy cable is rotten, the fishing is laborious, the music is the radium barrier, the tears are the fence, the carp is Li Li, the Li Li is the gravel, the Li Li is two couplets. Lotus, sickle, pity, curtain, face, chain, love, refining, grain cool, two chariots, healing, shackles, hunting, neighboring scales, renting bells, lingling ridge, collars, liu dragons, deaf throats, cages, ridges, long towers, lou baskets, reeds, lu skulls, lu furnaces Captives, captives, Lu bribes, Lu Lu, land donkeys, Lu Al couples, repeated threads, green mountains, twins, chaos, wheeling, Lunlun, Lunlun, Luoluo, gong, basket, mule, Luoluo, mama, mama, scolding, buying wheat, selling, mai pulse, concealing The steamed bun is so full that the cat anchor rivet trade is so moldy and boring that the door is boring and the door is boring. Ning Ning Niu Niu Pu Nong malano Ou Ou beat up vomiting retting plate Pang Guoai compensate spray peng cheat floating frequency poor apple by comment pour po Pu Pu Pu Pu Pu navel Qi Qi Qi Qi Qi discarded pull the skewer solder lead move signed full money pliers Dive into the shallow trench, choke the wall with gun, forcibly grab the shovel bridge, Qiao Qiaoqiao's orifice, steal the kiss, light hydrogen, please Qingqiong, Qiongqiong's body in the poor area, drive away the caries, right to persuade, but magpie, let Rao disturb the heat, toughness, recognition, softness, softness and sharpness. Moisten the gills, race the umbrella, mourn, sweep the astringent, kill the gauze, dry the yarn, flash the Shaanxi support, repair the injury, appreciate the burning, take the photo, set the gentry to judge the aunt, the kidney seepage, the rope, the saint, the lion, the wet poem, the corpse, the eclipse, the real knowledge, the driving force, the interpretation, the examination. The longevity animal pivot loses the book to redeem the attribute tree. Tang tangtao, Teng Teng, antimony, title, upper strip, iron hall, listening to hydrocarbons, copper, head, picture, Tutuan, sloughing off, ostrich, camel, oval, stockings, curved bay, stubborn Wanwang, Wei Weiwei, Weiwei Weiwei, pseudowei, Wei Wenwen. Wen Wen asked Weng Lao Wo Wo Wu tungsten Wu false accusation Wuwu Wu Wu fog service mistakenly attacked Xi Xian Xian Xi Xia Xia Xia Xia Xia Xia Xia Xian Xian Xian Xian Xian Xianxian Xian Xian Xian Xian Xian Xian Xian Xianxian Xianxiang Xiang Xiang Xiang Xiang Xiang Xiao Xiaoxiao Scorpion Association threatens Xie Xie Xing Xing Xiang Xiang Xiu Xi Xu Xu Xuan Xuan Xuan Xuan Xuan Xuan Xuan Xue Xun inquires and trains the news Xun Press Crow Duck Dumb Asia Surprise Castration Smoke Salt Yan Yan Yanyan is disgusted with Yanyan Yan proverb check duck Yang Yang Yang Yang itching raise sample Yao Yao Yao Yao kiln ballad Yao Ye Ye Ye Yi Yi Yi Yiyi Yi Yi Yi Yi Yi Yi Yi Yiyi Translation Variations Yin Yin Silver Drink Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Yong Yong You You You You You You You Lu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yuan Yuan Yuan Yuan Yuan Yuan Yuan Yuan Yue Yue Yue Yue Yue Yue Yue Yu Yu Yue Yun Yun's misfortune is full of misfortune, miscellaneous disasters, temporary praise, stolen goods, chiseled jujube stoves, blame selection, Zeze thieves, gifts, zaza, rolling guillotines, defrauding fasting debts, felt lamps, beheading, rolling brand stacks, wars, openings, rising accounts, bloating, Zhao Zhezhe, germanium This Zhenzhen detection and suppression array is full of ferocious frames. The shape of the cone is embellished with turbidity, and the traces of the data are traced. The Zou curse group is drilled to the bell. Why is it only accurate to open the board and the rest of the chain leaks';
}
function FTPYStr()
{
return '爱琱豱墄AO dam ba bal ga gaobao trip gang tie pound slander peeling full treasure repay Bao generation bei barium 狈狋 preparation exhausted stretch pen Bi die close The edge is derogatory, the braid is braided, the turtle is deflated, the Bin is on the shore, the cake is turned into a bowl, the divination is patched, the ginseng is added, the silkworm is left, the cabin is in the cabin, the toilet is in the toilet, the side book is measured, mixed with cicadas, gluttonous and slandered, entangled with shovels, produced in the trembling field, tasted long intestines The factory is full of money, the money truck is dusty, the Chen lining is said to be punished, the idiot is late, the shame is blazing, the insect is petting, the silk is ugly, the kitchen is hoeing, the base is stored, the sores are spread, the bruises are broken, the hammer is pure rhetoric, the words are clever, the onion is from the bush. Make up the mistake to bring the loan bill Dan Shan Shan Dan Dan bomb when the party swings the island to pray for theft of the light Deng enemy Di delivery point pad electric deposit fishing stack spy stack nail top ingot set Dongdong Dongdong frozen bucket calf alone Reading, gambling, plating, forging, breaking satin, team, tonton blunt, seizing the goose's forehead, corrupting the hungry children, baiting and punishing the valve, enamel, vanadium, Fanfanfan, visiting the spinning, flying waste, many graves, vigorously indignant, Fenfengfengfengfeng crazy, Fengzuo satirical. The phoenix-skinned radiant Fufu complex burden obituary woman tied the calcium cover dry drive Gan Gang Gang Gang Gao pickaxe put pigeon pavilion chromium one to Gong Gonggong Gong hook ditch purchase enough Gu Gu cut Guanguan Guanguan customary Guanggui The silicon returns to the turtle's boudoir, the treacherous cabinet, the expensive executioner, the rolling pot, the country is horrified, the Han and Han dynasties are congratulating, and the red pot is protecting the Shanghai household. Bribery and dirty gatherings, taboos, pictures of dirty gangs, harvesting goods, attacking machines, starving, ridiculing chickens, collecting extremely high-level collections, squeezing a few thistles, economic plans, Jiji, Jiji, Jiajia, potassium price, driving, annihilating, prison, and hard copywriting. Check the alkali, pick up, simplify and reduce the recommended threshold, inspect the base, see the key, the sword, the pulp, the pulp, the oar, the sauce, the glue, the sauce, the jiao, the hinge, the fluke, the foot, the dumpling, the sedan, the stalk, the stem, the neck, the static mirror. Jing Jing Jing cleans up the old horse, proves the saw fear, the cuckoo, the silk, the Jie, the Jie, the Jin, the Jin, only Jin Jin, Jin Jingjue, Jing Jue, Jue Jun, Jun Jun, Kai Ke Ke Ke, reclamation, digging out the trousers and exaggerating. The wide mine is open, the situation is poor, the feed is broken, the wax is lai, the blue fence is the basket, the orchid is the Lan Lan, the lazy cable is rotten, the fishing is laborious, the music is the radium barrier, the tears are the fence, the carp is Li Li, the Li Li is the gravel, the Li Li is two couplets. Lotus, sickle, pity, curtain, face, chain, love, refining, grain cool, two chariots, healing, shackles, hunting, neighboring scales, renting bells, lingling ridge, collars, liu dragons, deaf throats, cages, ridges, long towers, lou baskets, reeds, lu skulls, lu furnaces Captives, captives, Lu bribes, Lu Lu, land donkeys, Lu Al couples, repeated threads, green mountains, twins, chaos, wheeling, Lunlun, Lunlun, Luoluo, gong, basket, mule, Luoluo, mama, mama, scolding, buying wheat, selling, mai pulse, concealing The steamed bun is so full that the cat anchor rivet trade is so moldy and boring that the door is boring and the door is boring. Ning Ning Niu Niu Pu Nong malano Ouou beating up vomiting retting plate Pang Guoai compensation spraying Peng cheating floating frequency poor apple by comment splashing Pu Pu Pu Pu navel Qi Qi Qi Qi Qi Qi abandon pull Yan Hao lead move sign full money pliers Dive into the shallow trench, choke the wall with gun, forcibly grab the shovel bridge, Qiao Qiaoqiao's orifice, steal the kiss, light hydrogen, please Qingqiong, Qiongqiong's body in the poor area, drive away the caries, right to persuade, but magpie, let Rao disturb the heat, toughness, recognition, softness, softness and sharpness. Moisten the gills, race the umbrella, mourn, sweep the astringent, kill the gauze, dry the yarn, flash the Shaanxi support, repair the injury, appreciate the burning, take the photo, set the gentry to judge the aunt, the kidney seepage, the rope, the saint, the lion, the wet poem, the corpse, the eclipse, the real knowledge, the driving force, the interpretation, the examination. The longevity animal pivot loses the book to redeem the attribute tree. Tang tangtao, Teng Teng, antimony, title, upper strip, iron hall, listening to hydrocarbons, copper, head, picture, Tutuan, sloughing off, ostrich, camel, oval, stockings, curved bay, stubborn Wanwang, Wei Weiwei, Weiwei Weiwei, pseudowei, Wei Wenwen. Wen Wen asked Weng Lao Wo Wo Wu Wu tungsten Wu false accusation Wuwu Wu Wu fog service mistakenly attacked Xi Xian Xian Xia Xia Xia Xia Xia Xia Xian Fiber Xian Xian Xian Xian Xian Xian Xian Xian Xian Xian Xian Xian Xian Xiangxiang Xiang Xiang Xiang Xiang Xiang Xiao Xiaoxiao Scorpion Association threatens Xie Xie Xing Xing Xiang Xiang Xiu Xi Xu Xu Xuan Xuan Xuan Xuan Xuan Xuan Xuan Xue Xun inquires and trains the news Xun Press Crow Duck Dumb Asia Surprise Castration Smoke Salt Yan Yan Yanyan is disgusted with Yanyan Yan proverb check duck Yang Yang Yang Yang itching raise sample Yao Yao Yao Yao kiln ballad Yao Ye Ye Ye Yi Yi Yi Yiyi Yi Yi Yi Yi Yi Yi Yi Yiyi Translation Variations Yin Yin Silver Drink Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Ying Yong Yong You You You You You You You Lu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yu Yuan Yuan Yuan Yuan Yuan Yuan Yuan Yuan Yue Yue Yue Yue Yue Yue Yue Yu Yu Yue Yun Yun's misfortune is full of misfortune, miscellaneous disasters, temporary praise, stolen goods, chiseled jujube stoves, blame selection, Zeze thieves, gifts, zaza, rolling guillotines, defrauding fasting debts, felt lamps, beheading, rolling brand stacks, wars, openings, rising accounts, bloating, Zhao Zhezhe, germanium This Zhenzhen detection and suppression array is full of ferocious frames. The shape of the cone, the pendant, the turbidity, the total length, the Zou curse group, the drill, the bell, the only accurate opening, the rest of the chain leaking';
}
function Traditionalized(cc){
var str='',ss=JTPYStr(),tt=FTPYStr();
for(var i=0;i {
if(cc.charCodeAt( i )>10000&&ss.indexOf(cc.charAt(i))!=-1)str =tt.charAt(ss.indexOf(cc.charAt(i)));
else str =cc.charAt(i ) ;
}
return str;
}
function Simplized(cc){
var str='',ss=JTPYStr(),tt=FTPYStr();
for ( var i=0;i {
if(cc.charCodeAt(i)>10000&&tt.indexOf(cc.charAt(i))!=-1)str =ss . charAt(tt.indexOf(cc.charAt(i)));
else str =cc.charAt(i);
}
return str;


function setCookie(name, value)     //cookies设置  

    var argv = setCookie.arguments; 
    var argc = setCookie.arguments.length; 
    var expires = (argc > 2) ? argv[2] : null; 
    if(expires!=null) 
    { 
        var LargeExpDate = new Date (); 
        LargeExpDate.setTime(LargeExpDate.getTime() (expires*1000*3600*24)); 
    } 
    document.cookie = name "=" escape (value) ((expires == null) ? "" : ("; expires=" LargeExpDate.toGMTString())); 


function getCookie(Name)            //cookies读取  

    var search = Name "=" 
    if(document.cookie.length > 0)  
    { 
        offset = document.cookie.indexOf(search) 
        if(offset != -1)  
        { 
            offset = search.length 
            end = document.cookie.indexOf(";", offset) 
            if(end == -1) end = document.cookie.length 
            return unescape(document.cookie.substring(offset, end)) 
         } 
    else return "" 
      } 


var gb2big5_Obj=document.getElementById("gb2big5") 
if (gb2big5_Obj) 

    var JF_cn="ft" self.location.hostname.toString().replace(//./g,"")  
    var BodyIsFt=getCookie(JF_cn) 
    if(BodyIsFt!="1")BodyIsFt=Default_isFT 
    with(gb2big5_Obj) 
    { 
        if(typeof(document.all)!="object")  //非IE浏览器  
        { 
            href="javascript:StranBody()" 
        } 
        else 
        { 
            href="#"; 
            onclick= new Function("StranBody();return false") 
        } 
        title=StranText("点击以繁体中文方式浏览",1,1) 
        innerHTML=StranText(innerHTML,1,1) 
    } 
    if(BodyIsFt=="1"){setTimeout("StranBody()",StranIt_Delay)} 
}

繁體中文
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template