上图: 注意下面的代码,最好保存为utf-8格式的,要不容易出现乱码。 复制代码 代码如下: javascript 金山词霸在线网络翻译 <BR>function $(id) { return document.getElementById(id); } <BR>function callScript(url, loaded, error, charset) { <BR>var script = document.createElement("script"); <BR>if (typeof charset == "string") script.charset = charset; <BR>script.onreadystatechange = function() { <BR>switch (this.readyState) { <BR>case "complete": <BR>case "loaded": <BR>if (typeof loaded == "function") loaded(); <BR>if (script.parentNode) script.parentNode.removeChild(script); <BR>break; <BR>} <BR>} <BR>script.onload = function() { <BR>if (typeof loaded == "function") loaded(); <BR>if (script.parentNode) script.parentNode.removeChild(script); <BR>} <BR>script.onerror = function() { <BR>if (typeof error == "function") error(); <BR>if (script.parentNode) script.parentNode.removeChild(script); <BR>} <BR>script.type = "text/javascript"; <BR>script.defer = "true"; <BR>script.src = url; <BR>var parent = document.getElementsByTagName("HEAD")[0] || document.documentElement; <BR>if (parent && parent.insertBefore) parent.insertBefore(script, parent.firstChild); <BR>} <BR>function button_translateClick() { <BR>var word = encodeURIComponent($("text_word").value); <BR>if (!word) { <BR>alert(''); <BR>$("text_word").focus(); <BR>return; <BR>} <BR>callScript("http://server.dict-co.iciba.com/jsInterface.php?uiType=0&w=" + word + "&type=6"); <BR>callScript("http://server.dict-co.iciba.com/jsInterface.php?uiType=0&w=" + word + "&dict=Dict,Tf,Enen,"); <BR>callScript("http://server.dict-co.iciba.com/jsInterface.php?uiType=0&w=" + word + "&dict=Dict,Tf,Enen,"); <BR>callScript("http://server.dict-co.iciba.com/jsInterface.php?uiType=0&w=" + word + "&type=2"); <BR>} <BR>function text_wordKeydown(e) { <BR>if (!e) e = window.event; <BR>switch (e.keyCode | e.which | e.charCode) { <BR>case 13: <BR>button_translateClick(); <BR>break; <BR>} <BR>} <BR>function LoveCallback(context) { <BR>$("div_context").innerHTML = context; <BR>} <BR>function dictCallBack(context) { <BR>$("div_head").innerHTML = context; <BR>} <BR>function tfCallback(context) { <BR>$("div_thesaurus").innerHTML = context; <BR>} <BR>function En2enCallback(context) { <BR>$("div_en2en").innerHTML = context; <BR>} <BR>function djCallback(context) { <BR>$("div_dj").innerHTML = context; <BR>} <BR>function searchDictByWord(e) { <BR>var element = typeof event != "undefined" ? event.srcElement : e.target; <BR>$("text_word").value = element.innerHTML; <BR>button_translateClick(); <BR>} <BR>