Five-stroke encoding query tool implemented by hta and ajax

Source: Internet
Author: User
Tags wubi

Save as an hta file.

Copy codeThe Code is as follows: <Head>
<Title> five-stroke encoding query tool </title>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312"/>

<HTA: Application
MaximizeButton = "No"
Icon = "http://www.w3cg.net/WuBi/wb.ico"
Id = "WuBiApp"
SingleInstance = "Yes"
ContextMenu = "Yes"
Sysmenu = "Yes"
WindowState = "Normal"
Border = "Thin"
MinimizeButton = "Yes"
ApplicationName = ""
Version = "1.0"
InnerBorder = "No"
Caption = "Yes"
ShowinTaskBar = "No"
/>

<Style type = "text/css">
<! --
Body {background: # d4d0c8 ;}
* {Font-family: Arial, sans-serif; font-size: 9pt; color: #333 ;}
# Main {width: 100%; height: 100% ;}
Textarea {line-height: 130% ;}
A: link, a: visited {text-decoration: none ;}
-->
</Style>

<Script language = "javascript">
<! --

Var url = "http://www.w3cg.net/wubi ";
Var btv1 = "you can change the drop-down list box to select the function you want ";
Var btv2 = "Thank you for sharing. You can click here to submit these Chinese character encoding information ";
Var btv3 = "if you are sure you have prepared a message, click here to submit it to the author ";
Var btv4 = "submitting data to the server. Please wait ...... ";
Var xmlhttp;

Try {
Xmlhttp = new ActiveXObject ("Microsoft. XMLHTTP ");
}
Catch (e ){
Alert ("sorry, you cannot create system objects. Please check your system settings. ");
Xmlhttp = false;
}

Function trim (str ){
Str = str. replace (/^ \ s */,"");
Str = str. replace (/\ s * $ /,"");
Return str;
}

Function window. onload (){
Var awidth, aheight;
Var swidth, sheight;
Awidth = 600;
Aheight = 300;
Swidth = screen. width;
Sheight = screen. height;
Window. resizeTo (awidth, aheight );
Var left, top;
Left = (swidth-awidth)/2;
Top = (sheight-aheight)/2;
Window. moveTo (left, top );
Document. getElementById ("btsubmit"). innerText = btv1;
If (xmlhttp ){
Var rult = document. getElementById ("result ");
Rult. innerText = "reading announcement information... ";
Xmlhttp. open ("get", url + "ResponseNews. asp? Number = "+ Math. random (), true );
Xmlhttp. send ();
Xmlhttp. onreadystatechange = function (){
If (xmlhttp. readystate = 4 ){
If (xmlhttp. status = 200 ){
Rult. innerText = unescape (xmlhttp. responseText );
}
Else {
Rult. innerText = "An error occurred while reading the announcement. Check the network settings and try again. ";
}
}
}
}
}

Function ckeyword (){
Var key = document. getElementById ("keyword ");
If (key. value = "→ enter the Pinyin of the Chinese character whose encoding you want to query "){
Key. innerText = "";
}
}

Function keywordblur (){
Var key = document. getElementById ("keyword ");
If (key. value = ""){
Key. innerText = "→ enter the Pinyin of the Chinese characters you want to query ";
}
}

Function modonchange (){
Var sMod = document. getElementById ("module ");
Var key = document. getElementById ("keyword ");
Var rult = document. getElementById ("result ");
Var btsub = document. getElementById ("btsubmit ");
Switch (sMod. value ){
Case "cxmod ":
Location. reload ();
Break;
Case "tjmod ":
Key. innerText = "→ you are adding new encoding information ";
Key. disabled = true;
Var str;
Str = "the format of the new Chinese character encoding information submitted is \ n ";
Str + = "example, li, WGQJ, Hung Hom; \ n ";
Str + = "where \" example \ "is the Chinese character to be added; \" li \ "is the Pinyin of the Chinese character; \" WGQJ \ "is the five encoding of the Chinese character, we recommend that you use uppercase letters; \ "Hongyi \" is your name, which will appear during user query. ";
Str + = "If there are multiple records, separate them with semicolons. Enter all punctuation marks in English. \ N ";
Str + = "Salute to all the friends who have supported this tool! ";
Rult. innerText = str;
Btsub. disabled = false;
Btsub. innerText = btv2;
Break;
Case "lymod ":
Key. innerText = "→ you are performing a message operation ";
Key. disabled = true;
Var astr;
Astr = "could you tell me your comments and suggestions on this tool, or I would like to share my pleasure and unhappiness in your life, remember to leave your name, contact information, and other information when you send a letter or leave a message so that the author can reply. Thank you! \ N ";
Astr + = "author name: He Bing \ n ";
Astr + = "Network Name: Eleven Wolf, Wuling mad student, piuping student, etc. \ n ";
Astr + = "QQ: 112183883 \ n"
Astr + = "Email: 112183883@163.com, 112183883@qq.com \ n ";
Astr + = "Source Address: Sichuan shehong \ n ";
Astr + = "Current address: Hangzhou, Zhejiang Province ";
Rult. innerText = astr;
Btsub. disabled = false;
Btsub. innerText = btv3;
Break;
}
}

Function searchkey (){
Var key = document. getElementById ("keyword ");
Var rult = document. getElementById ("result ");
If (key. value. length! = 0 ){
If (xmlhttp ){
Xmlhttp. open ("get", url + "Search. asp? Py = "+ escape (trim (key. value) +" & numer = "+ Math. random (), true );
Xmlhttp. onreadystatechange = function (){
If (xmlhttp. readystate = 4 ){
If (xmlhttp. status = 200 ){
Rult. innerText = unescape (xmlhttp. responseText );
}
Else {
Rult. innerText = "An error occurred while querying. Check the network settings and try again. ";
}
}
// Else {
// Rult. innerText = "querying... ";
//}
}
Xmlhttp. send ();
}
}
}

Function btsubmitclick (){
Var sMod = document. getElementById ("module ");
Var rult = document. getElementById ("result ");
Var btrv = document. getElementById ("btsubmit ");
Switch (sMod. value ){
Case "tjmod ":
Btrv. disabled = true;
Rult. disabled = true;
If (xmlhttp ){
Var Rstr = "newletter =" + escape (rult. value );
Xmlhttp. open ("post", url + "Addnew. asp? Number = "+ Math. random (), true );
Xmlhttp. onreadystatechange = function (){
If (xmlhttp. readystate = 4 ){
If (xmlhttp. status = 200 ){
Rult. innerText = unescape (xmlhttp. responseText );
Btrv. innerText = btv2;
Btrv. disabled = false;
Rult. disabled = false;
}
Else {
Alert ("An error occurred while adding the new encoding. Check the network settings and try again. ");
Btrv. innerText = btv2;
Btrv. disabled = false;
Rult. disabled = false;
}
}
Else {
Btrv. innerText = btv4;
}
}
Xmlhttp. setRequestHeader ("content-length", Rstr. length );
Xmlhttp. setRequestHeader ("content-type", "application/x-www-form-urlencoded ");
Xmlhttp. send (Rstr );
}
Break;
Case "lymod ":
Btrv. disabled = true;
Rult. disabled = true;
If (xmlhttp ){
Var Gstr = "gstr =" + escape (rult. value );
Xmlhttp. open ("post", url + "Guest. asp? Number = "+ Math. random (), true );
Xmlhttp. onreadystatechange = function (){
If (xmlhttp. readystate = 4 ){
If (xmlhttp. status = 200 ){
Rult. innerText = unescape (xmlhttp. responseText );
Btrv. innerText = btv3;
Btrv. disabled = false;
Rult. disabled = false;
}
Else {
Alert ("An error occurred while adding the message. Check the network settings and try again. ");
Btrv. innerText = btv3;
Btrv. disabled = false;
Rult. disabled = false;
}
}
Else {
Btrv. innerText = btv4;
}
}
Xmlhttp. setRequestHeader ("content-length", Gstr. length );
Xmlhttp. setRequestHeader ("content-type", "application/x-www-form-urlencoded ");
Xmlhttp. send (Gstr );
}
Break;
}
}
// -->
</Script>
</Head>

<Body scroll = "no">
<Div id = "main">
<Fieldset style = "width: 100%; height: 100%; text-align: left;">
<Form name = "search" style = "margin: 10">
<Input type = "text" id = "keyword" value = "→ enter the pinyin character whose encoding you want to query." size = "40" style = "color: #789 "onfocus =" ckeyword () "onblur =" keywordblur () "onkeyup =" searchkey () "/>
<Select id = "module" onchange = "modonchange ()">
<Option value = "cxmod"> query mode </option>
<Option value = "tjmod"> Add mode </option>
<Option value = "lymod"> message mode </option>
</Select>
<Br/>
<Textarea rows = "10" cols = "100" id = "result" style = "margin-top: 5px;"> </textarea>
<Br/>
<Input type = "button" id = "btsubmit" disabled = "true" style = "width: 310px; margin-top: 7px" onclick = "btsubmitclick ()">
<A href = "#" onclick = "location. reload ()"> refresh </a>
</Form>
</Fieldset>
</Div>
</Body>

</Html>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.