Page 1 of 1

Calling a function from a function

PostPosted: Wed Feb 08, 2023 8:27 pm
by Natter
I upload approximately the following HTML text to the Webview.
How to call the myfunc() function using the oWebview:Eval() method ?

(DG - external handler)

Code: Select all  Expand view
<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
       <script>
   
        DG.then(function() {
           function myfun() {
              alert(123) ;
           } ;
        }) ;

      </script>
    </body>
</html>

Re: Calling a function from a function

PostPosted: Thu Feb 09, 2023 8:03 am
by Antonio Linares
oWebview:Eval( "myfun()" )

Re: Calling a function from a function

PostPosted: Thu Feb 09, 2023 8:51 am
by Natter
If so, then oWebview:Eval("myfun()") does not work
Code: Select all  Expand view
DG.then(function() {
     function myfun() {
           alert(123) ;
      } ;
 }) ;


If so, then oWebview:Eval("myfun()") works well
Code: Select all  Expand view
DG.then(function() {
}) ;
 function myfun() {
      alert(123) ;
  } ;