Solved

Java Applet - returning information

Posted on 2004-09-11
5
174 Views
Last Modified: 2010-03-31
Hi,
   Is it possible ( or easy ) to pass values back from an Applet into the HTML page it was called from? A friend is writing a colour picker which works really well... only he isn't sure how to make that available in the html page or if its even possible.... I don't know either so I thought I'd ask the gurus :)

thanks in advance!
0
Comment
Question by:petepalmer
  • 3
  • 2
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 12034357
Yes. You can call the applet from JavaScript and vice versa.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 125 total points
ID: 12034366
Although it's easier to call public methods of the applet from JavaScript using a reference:

var applet = document.applets[0];
var x = applet.foo();

you can also do it the other way around:

http://www.rgagnon.com/javadetails/java-0172.html
http://www.apl.jhu.edu/~hall/java/JavaScript-from-Java.html
0
 
LVL 1

Author Comment

by:petepalmer
ID: 12034421
That's what I've been trying.... I'll go double check my code :)

hold the answers for now please :)
0
 
LVL 1

Author Comment

by:petepalmer
ID: 12034447
I had it right but the string I was trying to return was wrong....grrr...

oh well at least I knew I was on the right track after all. thanks CEHJ!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12034452
8-)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now