Solved

Passing parameters to a Java applet from JavaScript

Posted on 1998-10-20
6
429 Views
Last Modified: 2008-03-03
Does anyone know how can I pass parameters to a Java applet on a web page using JavaScript's onclick that calls a function.

I want to be able to pass different parameters to the applet every time a button has been clicked etc.

Any ideas?

By the way. I'm using Netscape 3 under Win95.
0
Comment
Question by:dedo_mraz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:dedo_mraz
ID: 1272521
Edited text of question
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 100 total points
ID: 1272522
<APPLET NAME="myApplet"....>

<FORM>
<INPUT TYPE="BUTTON" VALUE="javafunction1" onClick="document.myApplet.javafunction1()">
<INPUT TYPE="BUTTON" VALUE="javafunction2" onClick="document.myApplet.javafunction2()">
</FORM>

The functions need to be public and the applet needs to have been loaded first... NS3 is finicky about reloading applets at resize though so be careful...

Michel
0
 

Author Comment

by:dedo_mraz
ID: 1272523
Good one Michel, but...

I know how to invoke methods that are already defined inside the applet and do things.

My question was:

If I have an applet like this...

<applet code="paramtst" name="appletBig"
    width="266" height="150">
        <param name="someNumber" value="12346">
        <param name="someText" value="Whats up Doc?!">
</applet>

How do I pass a parameter to "someNumber" using onclick ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1272524
I would think
<INPUT TYPE="TEXT" NAME="SomeNumber">
<INPUT TYPE="BUTTON" VALUE="SetSomeNumber"
onClick="document.myApplet.someNumber=parseInt(this.form.SomeNumber);">

but I am not 100% sure on this. Since the parameters are normally read in the init() method, wouldn't it be safer to do a
<INPUT TYPE="BUTTON" VALUE="Set SomeNumber"
onClick="document.myApplet.setSomeNumber(parseInt(this.form.SomeNumber))">
and have a public function to change the parameters.

Michel
0
 

Author Comment

by:dedo_mraz
ID: 1272525
Do you by any chance have a/some URL/s handy that use the above implementation?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1272526
The implementation is pretty straight forward but have a closer look at Live Wire at http://devedge.netscape.com

Michel
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

729 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