| Author |
Returning Parameters from Javascript to Java
|
Padmalatha Kontham
Greenhorn
Joined: Jun 21, 2007
Posts: 6
|
|
Hi, My requirement is to write a javascript for opening a confirm box on the click of a button. When the user clicks on "OK" button, the javascript should return a value "true" and when the user clicks on the "Cancel" button, "False" value should be returned. I need to use these boolean variables outside the java script. Is it possible for the javascript to return a value which can be used outside the script. Please suggest me how to write the code for this. Regards, Padmalatha.K
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Padmalatha, var result = confirm(); stores the result in a Javascript variable. You can use these within other Javascript on the same page. You can also use JavaScript to set a hidden form field with the value and pass it to Java.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
|
You'll need to explain what you mean by "outside the script". As Jeanne pointed out, you can submit it back to the server via a form submission, but to go into more detail you'll need to be more specific.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: Returning Parameters from Javascript to Java
|
|
|