Last Update:2017-08-24
Source: Internet
Author: User
Keywords
Web page production
Ajax
javascript
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd" > <html xmlns= "http://www.w3.org/1999/xhtml" > <head> <meta http-equiv= "Content-type" content= "HTML; Charset=utf-8 "/> <title> Web Effects Traditional Chinese conversion code </title>
</head>
<body>
<a href= "#" Name= "Stranlink" > Traditional Chinese </a> People's Republic of China <script language= "Web Effects" type= "Text/javascript" > var default_isft = 0; Default is traditional, 0-simplified, 1-Traditional var stranit_delay = 50//Translation delay millisecond (this is designed to let the Web page appear smoothly first) //-------code Start, do not change the following-- //Convert text function Strantext (txt,toft,chgtxt) { if (txt== "" | | Txt==null) return "" Toft=toft==null?bodyisft:toft if (chgtxt) txt=txt.replace (Toft?) Jane ":" (Toft?) Fan ":" Jane ") if (Toft) {return traditionalized (TXT)} else {return simplized (TXT)} } //Convert object, use recursion, peel to text layers function Stranbody (fobj) { if (typeof (fobj) = = "Object") {var obj=fobj.childnodes} Else { var tmptxt=stranlink_obj.innerhtml.tostring () if (Tmptxt.indexof ("Jane") <0) { bodyisft=1 Stranlink_obj.innerhtml=strantext (tmptxt,0,1) Stranlink.title=strantext (stranlink.title,0,1) } Else { bodyisft=0 Stranlink_obj.innerhtml=strantext (tmptxt,1,1) Stranlink.title=strantext (stranlink.title,1,1) } Setcookie (jf_cn,bodyisft,7) var obj=document.body.childnodes } for (var i=0;i<obj.length;i++) { var oo=obj.item (i) if ("| | Br|hr|textarea| ". IndexOf ("|") +oo.tagname+ "|") >0| | Oo==stranlink_obj) re-enters; 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 "; } function ftpystr () { return "; } function traditionalized (cc) { var str= ', Ss=jtpystr (), Tt=ftpystr (); for (var i=0;i<cc.length;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<cc.length;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 set { 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 Read { 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 Stranlink_obj=document.getelementbyid ("Stranlink") if (stranlink_obj) { var jf_cn= "FT" +self.location.hostname.tostring (). Replace (/./g, "") var Bodyisft=getcookie (JF_CN) if (bodyisft!= "1") bodyisft=default_isft with (stranlink_obj) { if (typeof (Document.all)!= "Object")//non IE browser { href= "" } Else { href= "#"; onclick= new Function ("Stranbody (); return false") } title=strantext ("Traditional Chinese", 1, 1) Innerhtml=strantext (innerhtml,1,1) } if (bodyisft== "1") {settimeout ("stranbody ()", Stranit_delay)} } </script> </body> </html>