Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TMS VCL WebGMaps
How to add a custom JavaScript function with the OnInitHTML event
How to add a custom JavaScript function with the OnInitHTML event
Below is an example of how you can add a custom JavaScript function with the OnInitHTML event. You can then call the function by using the ExecJScript call.
procedure TForm1.WebGMaps1InitHTML(Sender: TObject; var HTML: string); begin HTML := HTML + '<script>function sampleFunction(msg){alert(msg);}</script>'; end; procedure TForm1.Button1Click(Sender: TObject); begin WebGMaps1.ExecJScript('sampleFunction("Hello World");'); end;