WebControl.ExecuteJavaScript

From Xojo Documentation

Revision as of 15:55, 11 August 2017 by PLefebvre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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