All functions   Mac OS X   Windows   Crossplatform   Components   New in version: 1.0   1.1   1.2   1.3   1.4   1.5   1.6   1.7   1.8   2.0  

WebView.RunJavaScript

Component: WebView
Mac OS X: Works
Windows: Works

MBS( "WebView.RunJavaScript" ; WebViewerRef; Javascript )

Parameters

Parameter Description Example value
WebViewerRef Either the Web Viewer Object Name or the Web Viewer ID as returned by "WebView.FindByName" function.
Javascript The Javascript to be executed

Description

Executes the Javascript on the specified webViewer control. Allows you to call any Javascript function that is in loaded in the WebViewer OR you can just run arbitrary JavaScript on an empty web page. The results of the JavaScript are returned on Macintosh only. There is another function called WebView.RunJavaScriptReturnTitle which can be used to return the value of a Javascript function on both platforms

Examples

Set the htmlcode of a field as string:

MBS( "WebView.RunJavaScript"; "browser"; "document.getElementById('td_ProcName_v').innerHTML='hello';" )

Run JavaScript

Let(

[

// very simple javascript

javascript = "alert('OK');";

webViewerName = "myWebViewer";
windowRef = MBS("Window.FindByTitle"; Get ( WindowName ));
webViewerID = MBS("WebView.FindByName"; windowRef; webViewerName)

];
Case(
webViewerID = 0; "Web Veiwer \"" & webViewerName & "\" Not Found: " &windowRef ;

MBS("WebView.RunJavaScript"; webViewerID; javaScript)

)

)

Feedback: Report problem or ask question.