📄 漫谈wince输入法的编写(二)wince,输入法.mht
字号:
} else if (target =3D=3D "MasterPage") {=0A=
encodedData +=3D "&Anthem_MasterPageMethod=3D" + method;=0A=
} else if (target =3D=3D "Control") {=0A=
encodedData +=3D "&Anthem_ControlID=3D" + =
id.split(":").join("_");=0A=
encodedData +=3D "&Anthem_ControlMethod=3D" + method;=0A=
}=0A=
if (args) {=0A=
for (var argsIndex =3D 0; argsIndex < args.length; ++argsIndex) {=0A=
if (args[argsIndex] instanceof Array) {=0A=
for (var i =3D 0; i < args[argsIndex].length; ++i) {=0A=
encodedData +=3D "&Anthem_CallBackArgument" + argsIndex + "=3D" + =
Anthem_Encode(args[argsIndex][i]);=0A=
}=0A=
} else {=0A=
encodedData +=3D "&Anthem_CallBackArgument" + argsIndex + "=3D" + =
Anthem_Encode(args[argsIndex]);=0A=
}=0A=
}=0A=
}=0A=
if (updatePageAfterCallBack) {=0A=
encodedData +=3D "&Anthem_UpdatePage=3Dtrue";=0A=
}=0A=
if (includeControlValuesWithCallBack) {=0A=
var form =3D document.getElementById(Anthem_FormID);=0A=
if (form !=3D null) {=0A=
for (var elementIndex =3D 0; elementIndex < form.length; =
++elementIndex) {=0A=
var element =3D form.elements[elementIndex];=0A=
if (element.name) {=0A=
var elementValue =3D null;=0A=
if (element.nodeName.toUpperCase() =3D=3D "INPUT") {=0A=
var inputType =3D element.getAttribute("type").toUpperCase();=0A=
if (inputType =3D=3D "TEXT" || inputType =3D=3D "PASSWORD" || =
inputType =3D=3D "HIDDEN") {=0A=
elementValue =3D element.value;=0A=
} else if (inputType =3D=3D "CHECKBOX" || inputType =3D=3D =
"RADIO") {=0A=
if (element.checked) {=0A=
elementValue =3D element.value;=0A=
}=0A=
}=0A=
} else if (element.nodeName.toUpperCase() =3D=3D "SELECT") {=0A=
if (element.multiple) {=0A=
elementValue =3D [];=0A=
for (var i =3D 0; i < element.length; ++i) {=0A=
if (element.options[i].selected) {=0A=
elementValue.push(element.options[i].value);=0A=
}=0A=
}=0A=
} else if (element.length =3D=3D 0) {=0A=
elementValue =3D null;=0A=
} else {=0A=
elementValue =3D element.value;=0A=
}=0A=
} else if (element.nodeName.toUpperCase() =3D=3D "TEXTAREA") {=0A=
elementValue =3D element.value;=0A=
}=0A=
if (elementValue instanceof Array) {=0A=
for (var i =3D 0; i < elementValue.length; ++i) {=0A=
encodedData +=3D "&" + element.name + "=3D" + =
Anthem_Encode(elementValue[i]);=0A=
}=0A=
} else if (elementValue !=3D null) {=0A=
encodedData +=3D "&" + element.name + "=3D" + =
Anthem_Encode(elementValue);=0A=
}=0A=
}=0A=
}=0A=
// ASP.NET 1.1 won't fire any events if neither of the following=0A=
// two parameters are not in the request so make sure they're=0A=
// always in the request.=0A=
if (typeof form.__VIEWSTATE =3D=3D "undefined") {=0A=
encodedData +=3D "&__VIEWSTATE=3D";=0A=
}=0A=
if (typeof form.__EVENTTARGET =3D=3D "undefined") {=0A=
encodedData +=3D "&__EVENTTARGET=3D";=0A=
}=0A=
}=0A=
}=0A=
if (encodedData.length > 0) {=0A=
encodedData =3D encodedData.substring(1);=0A=
}=0A=
Anthem_DebugRequestText(encodedData.split("&").join("\n&"));=0A=
x.send(encodedData);=0A=
if (!clientCallBack) {=0A=
Anthem_DebugResponseText(x.responseText);=0A=
result =3D Anthem_GetResult(x);=0A=
if (result.error) {=0A=
Anthem_DebugError(result.error);=0A=
if (window.Anthem_Error) {=0A=
Anthem_Error(result);=0A=
}=0A=
}=0A=
if (updatePageAfterCallBack) {=0A=
Anthem_UpdatePage(result);=0A=
}=0A=
Anthem_EvalClientSideScript(result);=0A=
if (window.Anthem_PostCallBack) {=0A=
Anthem_PostCallBack();=0A=
}=0A=
}=0A=
return result;=0A=
}=0A=
=0A=
function Anthem_GetResult(x) {=0A=
var result =3D { "value": null, "error": null };=0A=
var responseText =3D x.responseText;=0A=
try {=0A=
result =3D eval("(" + responseText + ")");=0A=
} catch (e) {=0A=
if (responseText.length =3D=3D 0) {=0A=
result.error =3D "NORESPONSE";=0A=
} else {=0A=
result.error =3D "BADRESPONSE";=0A=
result.responseText =3D responseText;=0A=
}=0A=
}=0A=
return result;=0A=
}=0A=
=0A=
function Anthem_SetHiddenInputValue(form, name, value) {=0A=
var input =3D null;=0A=
if (form[name]) {=0A=
input =3D form[name];=0A=
} else {=0A=
input =3D document.createElement("input");=0A=
input.setAttribute("name", name);=0A=
input.setAttribute("type", "hidden");=0A=
}=0A=
input.setAttribute("value", value);=0A=
var parentElement =3D input.parentElement ? input.parentElement : =
input.parentNode;=0A=
if (parentElement =3D=3D null) {=0A=
form.appendChild(input);=0A=
form[name] =3D input;=0A=
}=0A=
}=0A=
=0A=
function Anthem_RemoveHiddenInput(form, name) {=0A=
var input =3D form[name];=0A=
if (input !=3D null && typeof(input) !=3D "undefined") {=0A=
var parentElement =3D input.parentElement ? input.parentElement : =
input.parentNode;=0A=
if (parentElement !=3D null) {=0A=
form[name] =3D null;=0A=
parentElement.removeChild(input);=0A=
}=0A=
}=0A=
}=0A=
=0A=
function Anthem_FireEvent(eventTarget, eventArgument, clientCallBack, =
clientCallBackArg, includeControlValuesWithCallBack, =
updatePageAfterCallBack) {=0A=
var form =3D document.getElementById(Anthem_FormID);=0A=
Anthem_SetHiddenInputValue(form, "__EVENTTARGET", eventTarget);=0A=
Anthem_SetHiddenInputValue(form, "__EVENTARGUMENT", eventArgument);=0A=
Anthem_CallBack(null, null, null, null, null, clientCallBack, =
clientCallBackArg, includeControlValuesWithCallBack, =
updatePageAfterCallBack);=0A=
form.__EVENTTARGET.value =3D "";=0A=
form.__EVENTARGUMENT.value =3D "";=0A=
}=0A=
=0A=
function Anthem_UpdatePage(result) {=0A=
var form =3D document.getElementById(Anthem_FormID);=0A=
if (result.viewState) {=0A=
Anthem_SetHiddenInputValue(form, "__VIEWSTATE", result.viewState);=0A=
}=0A=
if (result.viewStateEncrypted) {=0A=
Anthem_SetHiddenInputValue(form, "__VIEWSTATEENCRYPTED", =
result.viewStateEncrypted);=0A=
}=0A=
if (result.eventValidation) {=0A=
Anthem_SetHiddenInputValue(form, "__EVENTVALIDATION", =
result.eventValidation);=0A=
}=0A=
if (result.controls) {=0A=
for (var controlID in result.controls) {=0A=
var containerID =3D "Anthem_" + controlID.split("$").join("_") + "__";=0A=
var control =3D document.getElementById(containerID);=0A=
if (control) {=0A=
control.innerHTML =3D result.controls[controlID];=0A=
if (result.controls[controlID] =3D=3D "") {=0A=
control.style.display =3D "none";=0A=
} else {=0A=
control.style.display =3D "";=0A=
}=0A=
}=0A=
}=0A=
}=0A=
if (result.pagescript) {=0A=
Anthem_LoadPageScript(result, 0);=0A=
}=0A=
}=0A=
=0A=
// Load each script in order and wait for each one to load before =
proceeding=0A=
function Anthem_LoadPageScript(result, index) {=0A=
if (index < result.pagescript.length) {=0A=
try {=0A=
var script =3D document.createElement('script');=0A=
script.type =3D 'text/javascript';=0A=
if (result.pagescript[index].indexOf('src=3D') =3D=3D 0) {=0A=
script.src =3D result.pagescript[index].substring(4);=0A=
} else {=0A=
if (script.canHaveChildren ) {=0A=
=
script.appendChild(document.createTextNode(result.pagescript[index]));=0A=
} else {=0A=
script.text =3D result.pagescript[index];=0A=
}=0A=
}=0A=
var heads =3D document.getElementsByTagName('head');=0A=
if (heads !=3D null && typeof(heads) !=3D "undefined" && =
heads.length > 0) {=0A=
var head =3D heads[0];=0A=
=0A=
// The order that scripts appear is important since later =
scripts can=0A=
// redefine a function. Therefore it is important to add every =
script=0A=
// to the page and in the same order that they were added on =
the server.=0A=
// On the other hand, if we just keep adding scripts the DOM =
will grow=0A=
// unnecessarily. This code scans the <head> element block and =
removes =0A=
// previous instances of the identical script.=0A=
var found =3D false;=0A=
for (var child =3D 0; child < head.childNodes.length; child++) =
{=0A=
var control =3D head.childNodes[child];=0A=
if (control.tagName.toUpperCase() =3D=3D "SCRIPT") {=0A=
if (script.src.length > 0) {=0A=
if (script.src =3D=3D control.src) {=0A=
found =3D true;=0A=
break;=0A=
}=0A=
} else if (script.innerHTML.length > 0) {=0A=
if (script.innerHTML =3D=3D control.innerHTML) {=0A=
found =3D true;=0A=
break;=0A=
}=0A=
}=0A=
}=0A=
}=0A=
if (found) {=0A=
head.removeChild(control);=0A=
}=0A=
=0A=
// Now we append the new script and move on to the next script.=0A=
// Note that this is a recursive function. It stops when the=0A=
// index grows larger than the number of scripts.=0A=
=
document.getElementsByTagName('head')[0].appendChild(script);=0A=
if (typeof script.readyState !=3D "undefined") {=0A=
script.onreadystatechange =3D function() {=0A=
if (script.readyState !=3D "complete" && =
script.readyState !=3D "loaded") {=0A=
return;=0A=
} else {=0A=
Anthem_LoadPageScript(result, index + 1);=0A=
}=0A=
}=0A=
} else {=0A=
Anthem_LoadPageScript(result, index + 1);=0A=
}=0A=
}=0A=
} catch (e) {=0A=
Anthem_DebugError("Error adding page script to head. " + e.name + =
": " + e.message);=0A=
}=0A=
}=0A=
}=0A=
=0A=
function Anthem_EvalClientSideScript(result) {=0A=
if (result.script) {=0A=
for (var i =3D 0; i < result.script.length; ++i) {=0A=
try {=0A=
eval(result.script[i]);=0A=
} catch (e) {=0A=
alert("Error evaluating client-side script!\n\nScript: " + =
result.script[i] + "\n\nException: " + e);=0A=
}=0A=
}=0A=
}=0A=
}=0A=
=0A=
function Anthem_DebugRequestText(text) {=0A=
}=0A=
=0A=
function Anthem_DebugResponseText(text) {=0A=
}=0A=
=0A=
function Anthem_DebugError(text) {=0A=
}=0A=
=0A=
//Fix for bug #1429412, "Reponse callback returns previous response =
after file push".=0A=
//see =
http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1429412&grou=
p_id=3D151897&atid=3D782464=0A=
function Anthem_Clear__EVENTTARGET() {=0A=
var form =3D document.getElementById(Anthem_FormID);=0A=
Anthem_SetHiddenInputValue(form, "__EVENTTARGET", "");=0A=
}=0A=
=0A=
function Anthem_InvokePageMethod(methodName, args, clientCallBack, =
clientCallBackArg) {=0A=
Anthem_Clear__EVENTTARGET(); // fix for bug #1429412=0A=
return Anthem_CallBack(null, "Page", null, methodName, args, =
clientCallBack, clientCallBackArg, true, true);=0A=
}=0A=
=0A=
function Anthem_InvokeMasterPageMethod(methodName, args, clientCallBack, =
clientCallBackArg) {=0A=
Anthem_Clear__EVENTTARGET(); // fix for bug #1429412=0A=
return Anthem_CallBack(null, "MasterPage", null, methodName, args, =
clientCallBack, clientCallBackArg, true, true);=0A=
}=0A=
=0A=
function Anthem_InvokeControlMethod(id, methodName, args, =
clientCallBack, clientCallBackArg) {=0A=
Anthem_Clear__EVENTTARGET(); // fix for bug #1429412=0A=
return Anthem_CallBack(null, "Control", id, methodName, args, =
clientCallBack, clientCallBackArg, true, true);=0A=
}=0A=
=0A=
function Anthem_PreProcessCallBack(=0A=
control,=0A=
e,=0A=
eventTarget,=0A=
causesValidation, =0A=
validationGroup, =0A=
imageUrlDuringCallBack, =0A=
textDuringCallBack, =0A=
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -