*
The moose likes HTML, CSS and JavaScript and the fly likes Get the input box value from applet & transfer it to javaScript 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 "Get the input box value from applet & transfer it to javaScript" Watch "Get the input box value from applet & transfer it to javaScript" New topic
Author

Get the input box value from applet & transfer it to javaScript

Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
Good day!

I have an applet which is currently embedded in a JSP page.
What I am trying to do is to access or get the value in the
input box using javaScript.

Here is my applet tag


Here's what I used in javaScript:


But all I get is an undefined value.

[ UD: added linebreaks to preserve formatting ]
[ March 13, 2008: Message edited by: Ulf Dittmer ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41087
    
  43
The applet tag -which is what getElementById returns- does not have a "value" attribute. If you want to access data in the applet, write a public method that returns it, and call it like document.getElementById('appletbarcode').getValue().


Ping & DNS - my free Android networking tools app
Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
I'm sorry if I cross-posted.. I think I have done it twice today..

This is the code that I have written which simply shows an input box:


When I input a value in this applet, I wish to get it in javaScript.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41087
    
  43
As I said elsewhere, that's what LiveConnect does.
Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
Thanks for your reply.
I am starting to read in now, and hope that I'll be
able to understand and implement it.



BTW,
Can Live Connect be used in IE?
[ March 13, 2008: Message edited by: Darren Alexandria ]
 
Consider Paul's rocket mass heater.
 
subject: Get the input box value from applet & transfer it to javaScript
 
Similar Threads
Getting the value of the select box in a textbox
Problems when initiating applet for jre1.4.2 when jre1.5 is on the client
getting the value of the select list
jsf and javascript
Regarding document object in javascript