Source language: Translate to:

How to execute javascript function directly ?

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

How to execute javascript function directly ?

Postby David de Argentina » Wed Nov 20, 2013 9:37 am

Hi all,

I has an HTML file with some javascript functions.
In order to put in work, i added into the html, something like this:

Code: Select all
<input type="button" id="Show" value="Show" onclick="FunctionShow()"/>


And, into the NeoBook Program, i has something like this:

Code: Select all
BrowserExecScript "NavegadorWeb1" "document.getElementById('Show').click();" "JScript"


Are there any way to execute the "FunctionShow()" function directly, without calling a button click ?

Thanks in advance,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: How to execute javascript function directly ?

Postby dec » Wed Nov 20, 2013 9:47 am

Hello,

A possible way can be to use a global variable, something like this:

Code: Select all
<script>
  function Foo()
  {
    alert('Hello from Foo()');
  }
  window.Foo = Foo;
</script>


Then we can use the "BrowserExecScript" action in this way:

Code: Select all
BrowserExecScript "WebBrowser1" "window.Foo();" "JScript"
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: How to execute javascript function directly ?

Postby David de Argentina » Wed Nov 20, 2013 9:59 am

Thanks DEC !
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 2 guests