ExecutePageScriptA

表单、JavaScript 安全

描述

末尾的 A 表示 ANSI(char)DLL 入口点;ActiveX/COM 接口仅公开 Unicode 形式。其行为与 ExecutePageScript 相同,字符串参数按当前 SetAnsiMode 代码页解释

运行页面的打开或关闭 JavaScript 动作

语法

Delphi

Function DLExecutePageScriptA(InstanceID, Page: Integer; Trigger: PAnsiChar): Integer;

DLL

int DLExecutePageScriptA(int InstanceID, int Page, const char* Trigger);

参数

Page从 1 开始的页码
TriggerO 页面打开,C 页面关闭

返回值

脚本已运行返回 1;动作不存在(诊断报告 notRun,原因 missingAction)、触发器或目标非法(LastErrorCode 708,或表单/字段缺失),或脚本不受支持、非法或超预算(706、708、709)时返回 0

备注

event.type 为 Page,event.name 为 Open 或 Close;执行完毕后所选页面保持不变

脚本在有界表单脚本运行时中按配置的限制与宿主动作模式执行。event.type 与 event.name 标识事件,event.rc 不使用。脚本赋值的字段值(例如 getField("Total").value = ...)会写回文档

app.alert 之类的宿主动作绝不会被执行;参见 SetFormScriptHostActionMode

另请参阅

ExecuteFormFieldScriptEvent, SetFormScriptHostActionMode, GetFormScriptDiagnostics