wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: returning values from javascript function to java
 
Similar Threads
display text string with Javascript on screen
javascript inside java
Calling Javascript function from Java Code
Javascript accessing jsp variable
on mousedown event