<HTML> <Head> <Title> online translation </title> <Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"> </Head><Body> <% 'On error resume next 'If the network speed is slow, you can adjust the following time. Unit: seconds Server. scripttimeout = 999999 '================================================ ======================== 'Character encoding Functions '================================================ ======================== Function bytestobstr (body, code) Dim objstream Set objstream = server. Createobject ("ADODB. Stream ") Objstream. type = 1 Objstream. mode = 3 Objstream. Open Objstream. Write body Objstream. Position = 0 Objstream. type = 2 Objstream. charset = Code Bytestobstr = objstream. readtext Objstream. Close Set objstream = nothing End Function 'Position where the row string appears in another string Function newstring (wstr, strng) Newstring = instr (lcase (wstr), lcase (strng )) If newstring <= 0 then newstring = Len (wstr) End Function 'Replacement string Function Function replacestr (ORI, str1, str2) Replacestr = Replace (ORI, str1, str2) End Function '================================================ ==================== Function readxml (URL, code, start, ends) Set osend = Createobject ("Microsoft. XMLHTTP ") Sourcecode = osend. Open ("get", URL, false) Osend. Send () Readxml = bytestobstr (osend. responsebody, code) If (START = "" or ends = "") then Else Start = newstring (readxml, start) Readxml = mid (readxml, start) Ends = newstring (readxml, ends) Readxml = left (readxml, ends-1) End if End Function Dim urlpage, LAN Urlpage = request ("URLs ") LAN = request ("Lan ") %> <Form method = "Post" Action = "translate. asp"> <Input type = "text" name = "URLs" size = "150" value = "<% = urlpage %>"> <Input type = "hidden" name = "Lan" value = "<% = LAN %>"> <Input type = "Submit" value = "Submit"> </Form> <% Dim transurl Transurl = "http: // 216.239.39.104/translate_c? Hl = ZH-CN & Ie = UTF-8 & OE = UTF-8 & langpair = "& server. urlencode (LAN) &" & U = "& urlpage &" & Prev =/language_tools" If (LEN (urlpage)> 3) then Getcont = readxml (transurl, "gb2312 ","","") Response. Write (getcont) End if %> </Body> </Html> |