htmlutils.pas 689 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. library htmlutils;
  2. uses
  3. web;
  4. Type
  5. THTMLUtils = class(TObject)
  6. Public
  7. DefaultClearID : String;
  8. Procedure SetPageTitle(aTitle : String);
  9. Procedure ClearPage(aBelowID : String);
  10. end;
  11. Procedure THTMLUtils.SetPageTitle(aTitle : String);
  12. begin
  13. Document.Title:=aTitle;
  14. end;
  15. Procedure THTMLUtils.ClearPage(aBelowID : String);
  16. Var
  17. EL : TJSElement;
  18. begin
  19. if (aBelowID='') then
  20. aBelowID:=DefaultClearID;
  21. if (aBelowID='') then
  22. el:=Document.body
  23. else
  24. el:=Document.getElementById(aBelowID);
  25. if Assigned(El) then
  26. El.innerHTML:='';
  27. end;
  28. Function CreateUtils : THTMLUtils;
  29. begin
  30. Result:=THTMLUtils.Create;
  31. end;
  32. exports
  33. CreateUtils;
  34. end.