aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes returning values from javascript function to java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "returning values from javascript function to java" Watch "returning values from javascript function to java" New topic
Author

returning values from javascript function to java

sarah cruz
Greenhorn

Joined: Sep 21, 2005
Posts: 10
hello, i have a function in javascript which returns a string. how do i access this string outside of my script, for example in java? thanks.

here is an example:

void main () {

String code = "x.onklick = function () { display () }"
browser.execute (code);
}

function display () {
return ("hello");
}

the question is how do i access the string returned by display after browser.execute? i.e., outside the script itself. thanks.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Java and JavaScript work on two different levels. By the time the JavaScript is executed, the Java has been completed. You would have to submit a form or use Ajax to send the data back to the server.

Eric
[ May 31, 2006: Message edited by: Eric Pascarello ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: returning values from javascript function to java