delphi 调用javascript

function ExecScript(Code,Lang,Func:string):string;
var
  script:OleVariant;
begin
  try
    script:=CreateOleObject('ScriptControl');
    script.Language:=Lang;
    script.AddCode(Code);
    Result:=script.Eval(Func);
  except
  end;
end;

调用:AStr:= ExecScript(FPNFileRead('md5.txt'),'JavaScript','md5(md5_3("fengs0801.")+"YQUHX")');

你可能感兴趣的:(JavaScript,Delphi)