pas2js/demo/modules/simple/classusingvar/htmlutils.pas
Michaël Van Canneyt 8af3432c76 * More module demos
2022-03-05 17:49:35 +01:00

47 lines
678 B
ObjectPascal

library htmlutils;
uses
web;
Type
THTMLUtils = class(TObject)
Public
DefaultClearID : String;
Procedure SetPageTitle(aTitle : String);
Procedure ClearPage(aBelowID : String);
end;
Procedure THTMLUtils.SetPageTitle(aTitle : String);
begin
Document.Title:=aTitle;
end;
Procedure THTMLUtils.ClearPage(aBelowID : String);
Var
EL : TJSElement;
begin
if (aBelowID='') then
aBelowID:=DefaultClearID;
if (aBelowID='') then
el:=Document.body
else
el:=Document.getElementById(aBelowID);
if Assigned(El) then
El.innerHTML:='';
end;
var
Utils : THTMLUtils;
exports
Utils;
initialization
Utils:=THTMLUtils.Create;
end.