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

ExecuteJavaScript is also available as a global method. If called as a global method, it tries to determine which control in which it is supposed to run. In general, calling the JavaScript from inside the intended control is preferable.

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

ExecuteJavaScript, JavaScript