WebControl.ExecuteJavaScript

From Xojo Documentation

Method

WebControl.ExecuteJavaScript(JavaScript As String)

New in 2010r4

Supported for all project types and targets.

Executes the JavaScript passed. The JavaScript passed can call a JavaScript function in a WebPageSource control.

Notes

The Xojo web framework uses EcmaScript 6 which is more strict than previous versions of JavaScript. For more details, see the EcmaScript 6 documentation.

Example

This code in the Action event of a Button displays an alert using JavaScript:

Me.ExecuteJavaScript("alert('Hello!');")

This code will select the text in a WebTextField (or WebTextArea):

WebTextField1.ExecuteJavascript("document.getElementById('" + _
WebTextField1.ControlID + "_inner').select();")

See Also

JavaScript